diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands')
6 files changed, 24 insertions, 12 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index a9408360f..7480864d7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -7,6 +7,8 @@ import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; +import org.bukkit.BanList; +import org.bukkit.Bukkit; import org.bukkit.Server; @@ -61,9 +63,7 @@ public class Commandban extends EssentialsCommand banReason = tl("defaultBanReason"); } - user.setBanReason(tl("banFormat", banReason, senderName)); - user.getBase().setBanned(true); - user.setBanTimeout(0); + Bukkit.getBanList(BanList.Type.NAME).addBan(user.getName(), banReason, null, senderName); user.getBase().kickPlayer(tl("banFormat", banReason, senderName)); server.getLogger().log(Level.INFO, tl("playerBanned", senderName, user.getName(), banReason)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index 44c632356..4c6c8f230 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -289,7 +289,7 @@ public class Commandessentials extends EssentialsCommand continue; } - int ban = user.getBanReason().isEmpty() ? 0 : 1; + int ban = user.getBase().isBanned() ? 0 : 1; long lastLog = user.getLastLogout(); if (lastLog == 0) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java index 51a03c616..08d6cf4b3 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java @@ -9,6 +9,8 @@ import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.StringUtil; import java.util.ArrayList; import java.util.List; +import org.bukkit.BanList; +import org.bukkit.Bukkit; import java.util.UUID; import org.bukkit.Location; import org.bukkit.Server; @@ -59,6 +61,10 @@ public class Commandseen extends EssentialsCommand sender.sendMessage(tl("isIpBanned", args[0])); return; } + else if (Bukkit.getBannedPlayers().contains(Bukkit.getOfflinePlayer(args[0]))) { + sender.sendMessage(tl("whoisBanned", showBan ? Bukkit.getBanList(BanList.Type.NAME).getBanEntry(Bukkit.getOfflinePlayer(args[0]).getName()).getReason() : tl("true"))); + return; + } else { throw new PlayerNotFoundException(); @@ -137,7 +143,7 @@ public class Commandseen extends EssentialsCommand if (user.getBase().isBanned()) { - sender.sendMessage(tl("whoisBanned", showBan ? user.getBanReason() : tl("true"))); + sender.sendMessage(tl("whoisBanned", showBan ? Bukkit.getBanList(BanList.Type.NAME).getBanEntry(user.getName()).getReason() : tl("true"))); } final String location = user.getGeoLocation(); if (location != null && (!(sender.isPlayer()) || ess.getUser(sender.getPlayer()).isAuthorized("essentials.geoip.show"))) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index 478c2c257..aeaf4dbd8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -5,8 +5,11 @@ import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n.tl; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DateUtil; +import java.util.Date; import java.util.GregorianCalendar; import java.util.logging.Level; +import org.bukkit.BanList; +import org.bukkit.Bukkit; import org.bukkit.Server; @@ -61,9 +64,8 @@ public class Commandtempban extends EssentialsCommand final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; final String banReason = tl("tempBanned", DateUtil.formatDateDiff(banTimestamp), senderName, stringDregs); - user.setBanReason(banReason); - user.setBanTimeout(banTimestamp); - user.getBase().setBanned(true); + + Bukkit.getBanList(BanList.Type.NAME).addBan(user.getName(), banReason, new Date(banTimestamp), senderName); user.getBase().kickPlayer(banReason); final String message = tl("playerBanned", senderName, user.getName(), banReason, DateUtil.formatDateDiff(banTimestamp)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java index 44777dcd1..db358e0dd 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunban.java @@ -5,6 +5,8 @@ import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n.tl; import com.earth2me.essentials.User; import java.util.logging.Level; +import org.bukkit.BanList; +import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.Server; @@ -28,8 +30,7 @@ public class Commandunban extends EssentialsCommand { final User user = getPlayer(server, args, 0, true, true); name = user.getName(); - user.getBase().setBanned(false); - user.setBanTimeout(0); + Bukkit.getBanList(BanList.Type.NAME).pardon(name); } catch (NoSuchFieldException e) { @@ -39,7 +40,7 @@ public class Commandunban extends EssentialsCommand { throw new Exception(tl("playerNotFound"), e); } - player.setBanned(false); + Bukkit.getBanList(BanList.Type.NAME).pardon(name); } final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java index 1d79c94e0..b7477f7e7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java @@ -6,6 +6,8 @@ import static com.earth2me.essentials.I18n.tl; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; +import org.bukkit.BanList; +import org.bukkit.Bukkit; import org.bukkit.Server; @@ -46,8 +48,9 @@ public class Commandunbanip extends EssentialsCommand { throw new PlayerNotFoundException(); } + - ess.getServer().unbanIP(ipAddress); + Bukkit.getBanList(BanList.Type.IP).pardon(ipAddress); final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME; server.getLogger().log(Level.INFO, tl("playerUnbanIpAddress", senderName, ipAddress)); |