Revert changes to ban API from 1.7.8

By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
Bukkit/Spigot 2014-04-17 10:44:02 -05:00
parent 22428bb2fc
commit 328f4ee7c8
4 changed files with 4 additions and 28 deletions

View file

@ -20,10 +20,6 @@ public interface BanList {
* Banned player IP addresses
*/
IP,
/**
* Banned player UUID
*/
UUID,
;
}

View file

@ -29,17 +29,10 @@ public class BanCommand extends VanillaCommand {
return false;
}
Player player = Bukkit.getPlayer(args[0]);
String uuid;
if (player != null) {
uuid = player.getUniqueId().toString();
} else {
uuid = sender.getServer().getOfflinePlayer(args[0]).getUniqueId().toString();
}
String reason = args.length > 0 ? StringUtils.join(args, ' ', 1, args.length) : null;
Bukkit.getBanList(BanList.Type.UUID).addBan(uuid, reason, null, sender.getName());
Bukkit.getBanList(BanList.Type.NAME).addBan(args[0], reason, null, sender.getName());
Player player = Bukkit.getPlayer(args[0]);
if (player != null) {
player.kickPlayer("Banned by admin.");
}

View file

@ -29,7 +29,7 @@ public class BanListCommand extends VanillaCommand {
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
BanList.Type banType = BanList.Type.UUID;
BanList.Type banType = BanList.Type.NAME;
if (args.length > 0) {
if (args[0].equalsIgnoreCase("ips")) {
banType = BanList.Type.IP;
@ -51,18 +51,6 @@ public class BanListCommand extends VanillaCommand {
}
}
String output = banlist[x].getTarget();
if (banType == BanList.Type.UUID) {
try {
OfflinePlayer player = sender.getServer().getOfflinePlayer(UUID.fromString(output));
if (player.getName() != null) {
output = player.getName();
}
} catch (IllegalArgumentException ex) {
// We seem to have an invalid UUID, what do?
}
}
message.append(banlist[x].getTarget());
}

View file

@ -30,8 +30,7 @@ public class PardonCommand extends VanillaCommand {
return false;
}
String uuid = sender.getServer().getOfflinePlayer(args[0]).getUniqueId().toString();
Bukkit.getBanList(BanList.Type.UUID).pardon(uuid);
Bukkit.getBanList(BanList.Type.NAME).pardon(args[0]);
Command.broadcastCommandMessage(sender, "Pardoned " + args[0]);
return true;
}