From 7ae8d6908a77d05d2464a1e894151d2b493bc13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pani=C4=87?= Date: Sun, 7 Apr 2019 22:23:38 +0200 Subject: Added IP banning support --- .../java/com/redstoner/bungeeBans/commands/UnbanCommand.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/redstoner/bungeeBans/commands/UnbanCommand.java') diff --git a/src/main/java/com/redstoner/bungeeBans/commands/UnbanCommand.java b/src/main/java/com/redstoner/bungeeBans/commands/UnbanCommand.java index a495dbb..809c7d2 100644 --- a/src/main/java/com/redstoner/bungeeBans/commands/UnbanCommand.java +++ b/src/main/java/com/redstoner/bungeeBans/commands/UnbanCommand.java @@ -1,6 +1,5 @@ package com.redstoner.bungeeBans.commands; -import com.mojang.api.profiles.HttpProfileRepository; import com.mojang.api.profiles.Profile; import com.redstoner.bungeeBans.BanManager; import com.redstoner.bungeeBans.Util; @@ -14,8 +13,6 @@ import net.md_5.bungee.api.plugin.Command; import java.io.IOException; public class UnbanCommand extends Command { - HttpProfileRepository profileRepo = new HttpProfileRepository("minecraft"); - private BanManager bm; public UnbanCommand(BanManager bm) { @@ -28,8 +25,7 @@ public class UnbanCommand extends Command { public void execute(CommandSender sender, String[] args) { if (args.length != 1) { sender.sendMessage( - new ComponentBuilder(ChatColor.RED + "Invalid command! ") - .append("Usage: ") + new ComponentBuilder(ChatColor.RED + "Usage: ") .append(ChatColor.AQUA + "/unban ") .append(ChatColor.GOLD + " ") .create() @@ -38,7 +34,7 @@ public class UnbanCommand extends Command { return; } - Profile[] profiles = profileRepo.findProfilesByNames(args[0]); + Profile[] profiles = Util.findProfilesByNames(args[0]); if (profiles.length != 1) { sender.sendMessage(new TextComponent(ChatColor.RED + "Invalid name!")); @@ -59,9 +55,8 @@ public class UnbanCommand extends Command { try { bm.saveBans(); - sender.sendMessage(new TextComponent(ChatColor.GREEN + "Saved bans to file!")); } catch (IOException e) { - sender.sendMessage(new TextComponent(ChatColor.RED + "Failed to save bans to file!")); + sender.sendMessage(new TextComponent(ChatColor.RED + "Failed to save player bans to file! (nothing was changed)")); e.printStackTrace(); bm.addBan(ban); -- cgit v1.2.3