summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands
diff options
context:
space:
mode:
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands')
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandban.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandessentials.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandseen.java10
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtempban.java17
4 files changed, 23 insertions, 21 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
index 7480864d7..50b459a06 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
@@ -62,11 +62,13 @@ public class Commandban extends EssentialsCommand
{
banReason = tl("defaultBanReason");
}
-
+
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));
+ String banDisplay = tl("banFormat", banReason, senderName);
+
+ user.getBase().kickPlayer(banDisplay);
+ server.getLogger().log(Level.INFO, tl("playerBanned", senderName, user.getName(), banDisplay));
if (nomatch)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
index 4c6c8f230..23173661e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
@@ -264,15 +264,14 @@ public class Commandessentials extends EssentialsCommand
{
sender.sendMessage("This sub-command will delete users who havent logged in in the last <days> days.");
sender.sendMessage("Optional parameters define the minium amount required to prevent deletion.");
- sender.sendMessage("Unless you define larger default values, this command wil ignore people who have more than 0 money/homes/bans.");
- throw new Exception("/<command> cleanup <days> [money] [homes] [ban count]");
+ sender.sendMessage("Unless you define larger default values, this command wil ignore people who have more than 0 money/homes.");
+ throw new Exception("/<command> cleanup <days> [money] [homes]");
}
sender.sendMessage(tl("cleaning"));
final long daysArg = Long.parseLong(args[1]);
final double moneyArg = args.length >= 3 ? Double.parseDouble(args[2].replaceAll("[^0-9\\.]", "")) : 0;
final int homesArg = args.length >= 4 && NumberUtil.isInt(args[3]) ? Integer.parseInt(args[3]) : 0;
- final int bansArg = args.length >= 5 && NumberUtil.isInt(args[4]) ? Integer.parseInt(args[4]) : 0;
final UserMap userMap = ess.getUserMap();
ess.runTaskAsynchronously(new Runnable()
@@ -289,8 +288,6 @@ public class Commandessentials extends EssentialsCommand
continue;
}
- int ban = user.getBase().isBanned() ? 0 : 1;
-
long lastLog = user.getLastLogout();
if (lastLog == 0)
{
@@ -311,7 +308,7 @@ public class Commandessentials extends EssentialsCommand
int homeCount = user.getHomes().size();
double moneyCount = user.getMoney().doubleValue();
- if ((lastLog == 0) || (ban > bansArg) || (timeDiff < milliDays)
+ if ((lastLog == 0) || (timeDiff < milliDays)
|| (homeCount > homesArg) || (moneyCount > moneyArg))
{
continue;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
index 08d6cf4b3..f82342c30 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandseen.java
@@ -56,13 +56,15 @@ public class Commandseen extends EssentialsCommand
seenIP(server, sender, args[0]);
return;
}
- else if (FormatUtil.validIP(args[0]) && (server.getIPBans().contains(args[0])))
+ else if (Bukkit.getBanList(BanList.Type.IP).isBanned(args[0]))
{
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")));
+
+ else if (Bukkit.getBanList(BanList.Type.NAME).isBanned(args[0]))
+ {
+ sender.sendMessage(tl("whoisBanned", showBan ? Bukkit.getBanList(BanList.Type.NAME).getBanEntry(args[0]).getReason() : tl("true")));
return;
}
else
@@ -168,7 +170,7 @@ public class Commandseen extends EssentialsCommand
{
final UserMap userMap = ess.getUserMap();
- if (server.getIPBans().contains(ipAddress))
+ if (Bukkit.getBanList(BanList.Type.IP).isBanned(ipAddress))
{
sender.sendMessage(tl("isIpBanned", ipAddress));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
index aeaf4dbd8..dfb0139f1 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
@@ -47,8 +47,8 @@ public class Commandtempban extends EssentialsCommand
}
final String time = getFinalArg(args, 1);
final long banTimestamp = DateUtil.parseDateDiff(time, true);
- String stringDregs = DateUtil.removeTimePattern(time);
-
+ String banReason = DateUtil.removeTimePattern(time);
+
final long maxBanLength = ess.getSettings().getMaxTempban() * 1000;
if (maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength)
&& sender.isPlayer() && !(ess.getUser(sender.getPlayer()).isAuthorized("essentials.tempban.unlimited")))
@@ -56,17 +56,18 @@ public class Commandtempban extends EssentialsCommand
sender.sendMessage(tl("oversizedTempban"));
throw new NoChargeException();
}
-
- if (stringDregs.length() < 2)
+
+ if (banReason.length() < 2)
{
- stringDregs = tl("defaultBanReason");
+ banReason = tl("defaultBanReason");
}
final String senderName = sender.isPlayer() ? sender.getPlayer().getDisplayName() : Console.NAME;
- final String banReason = tl("tempBanned", DateUtil.formatDateDiff(banTimestamp), senderName, stringDregs);
-
Bukkit.getBanList(BanList.Type.NAME).addBan(user.getName(), banReason, new Date(banTimestamp), senderName);
- user.getBase().kickPlayer(banReason);
+
+ String banDisplay = tl("tempBanned", DateUtil.formatDateDiff(banTimestamp), senderName, banReason);
+ user.getBase().kickPlayer(banDisplay);
+ server.getLogger().log(Level.INFO, tl("playerBanned", senderName, user.getName(), banDisplay));
final String message = tl("playerBanned", senderName, user.getName(), banReason, DateUtil.formatDateDiff(banTimestamp));
server.getLogger().log(Level.INFO, message);