diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands')
37 files changed, 53 insertions, 71 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java b/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java index a98f448f0..30c062be9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandantioch.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.LocationUtil; import org.bukkit.Location; import org.bukkit.Server; @@ -22,7 +21,7 @@ public class Commandantioch extends EssentialsCommand { ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,"); ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it."); - } + } final Location loc = LocationUtil.getTarget(user); loc.getWorld().spawn(loc, TNTPrimed.class); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java index ec82c235d..8e8452ec8 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalance.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.NumberUtil; import java.math.BigDecimal; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java index ae7c25a56..e6a840998 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.textreader.SimpleTextInput; import com.earth2me.essentials.textreader.TextPager; import com.earth2me.essentials.utils.NumberUtil; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index d3510f1f7..260e68e03 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java index 2d34175d1..e1b861cb5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -25,25 +26,33 @@ public class Commandbanip extends EssentialsCommand } final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; - final String ipAddress; - final User player = ess.getUser(args[0]); - if (player == null) + String ipAddress; + if (FormatUtil.validIP(args[0])) { ipAddress = args[0]; } else { - ipAddress = player.getLastLoginAddress(); - if (ipAddress.length() == 0) + try { - throw new Exception(_("playerNotFound")); + User player = getPlayer(server, args, 0, true, true); + ipAddress = player.getLastLoginAddress(); } + catch (PlayerNotFoundException ex) + { + ipAddress = args[0]; + } + } + + if (ipAddress.isEmpty()) + { + throw new PlayerNotFoundException(); } ess.getServer().banIP(ipAddress); server.getLogger().log(Level.INFO, _("playerBanIpAddress", senderName, ipAddress)); - - ess.broadcastMessage(sender, "essentials.ban.notify", _("playerBanIpAddress", senderName, ipAddress)); + + ess.broadcastMessage(sender, "essentials.ban.notify", _("playerBanIpAddress", senderName, ipAddress)); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java index 405a3e703..082234c7e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbigtree.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.LocationUtil; import org.bukkit.Location; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java index e89ed45bc..e54866452 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbroadcast.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java index d3de475eb..d03a7a898 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandclearinventory.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.NumberUtil; -import com.earth2me.essentials.utils.StringUtil; import java.util.List; import org.bukkit.Server; import org.bukkit.command.CommandSender; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java index 300a1f90a..977eb45a7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.NumberUtil; import java.math.BigDecimal; import java.util.Locale; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index 126566e3e..ae2a368e2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.UserMap; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.metrics.Metrics; import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.NumberUtil; @@ -250,7 +249,7 @@ public class Commandessentials extends EssentialsCommand } int ban = user.getBanReason().equals("") ? 0 : 1; - + long lastLog = user.getLastLogout(); if (lastLog == 0) { @@ -260,7 +259,7 @@ public class Commandessentials extends EssentialsCommand { user.setLastLogin(currTime); } - + long timeDiff = currTime - lastLog; long milliDays = daysArg * 24L * 60L * 60L * 1000L; int homeCount = user.getHomes().size(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index ba84b6cf4..7013d7db9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
-import com.earth2me.essentials.utils.StringUtil;
import com.earth2me.essentials.craftbukkit.SetExpFix;
import com.earth2me.essentials.utils.NumberUtil;
import java.util.List;
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java index b07a93595..39ba4d421 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandfirework.java @@ -4,7 +4,6 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.MetaItemStack; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.NumberUtil; -import com.earth2me.essentials.utils.StringUtil; import java.util.regex.Pattern; import org.bukkit.FireworkEffect; import org.bukkit.Material; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java index ccfc2e598..f9a04386d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgc.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgc.java @@ -1,9 +1,8 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.utils.StringUtil; -import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.DateUtil; +import com.earth2me.essentials.utils.NumberUtil; import java.lang.management.ManagementFactory; import java.util.List; import org.bukkit.ChatColor; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 2a650fff1..13f58f8fe 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.textreader.*; import com.earth2me.essentials.utils.NumberUtil; import java.util.Locale; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java index 820efd343..f7f2c50bb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelpop.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java index edc67e482..62c002c12 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandjump.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandjump.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.LocationUtil; import org.bukkit.Location; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index f50bb4bfb..d4a46b9ef 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java index 95104fc61..e8453d90b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java index 62acdbb70..9fea6846c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.NumberUtil; import java.util.*; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandme.java b/Essentials/src/com/earth2me/essentials/commands/Commandme.java index e1b088e25..fe552f598 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandme.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandme.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -29,22 +28,22 @@ public class Commandme extends EssentialsCommand } String message = getFinalArg(args, 0); - message = FormatUtil.formatMessage(user, "essentials.chat", message); + message = FormatUtil.formatMessage(user, "essentials.chat", message); user.setDisplayNick(); ess.broadcastMessage(user, _("action", user.getDisplayName(), message)); } - + @Override public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception - { + { if (args.length < 1) { throw new NotEnoughArgumentsException(); } String message = getFinalArg(args, 0); - message = FormatUtil.replaceFormat(message); + message = FormatUtil.replaceFormat(message); ess.getServer().broadcastMessage(_("action", "@", message)); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java index ca33c33b2..5488dcbfb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmsg.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IReplyTo; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import java.util.List; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index 1a6ab80a2..a2b8ae20e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.DateUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java index d54524ba5..509c60794 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandnick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandnick.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import java.util.Locale; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandping.java b/Essentials/src/com/earth2me/essentials/commands/Commandping.java index bd0c25d90..72b5beca0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandping.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandping.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index e882c0233..a011540b1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IReplyTo; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -33,7 +32,7 @@ public class Commandr extends EssentialsCommand if (sender instanceof Player) { User user = ess.getUser(sender); - message = FormatUtil.formatMessage(user, "essentials.msg", message); + message = FormatUtil.formatMessage(user, "essentials.msg", message); replyTo = user; senderName = user.getDisplayName(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index 9cf194798..9eb91730e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import java.util.Locale; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java index 9ccfd21d1..5284a5cae 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import com.earth2me.essentials.utils.NumberUtil;
-import com.earth2me.essentials.utils.StringUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@@ -29,10 +28,10 @@ public class Commandrecipe extends EssentialsCommand {
throw new NotEnoughArgumentsException();
}
-
+
final ItemStack itemType = ess.getItemDb().get(args[0]);
int recipeNo = 0;
-
+
if (args.length > 1)
{
if (NumberUtil.isInt(args[1]))
@@ -44,21 +43,21 @@ public class Commandrecipe extends EssentialsCommand throw new Exception(_("invalidNumber"));
}
}
-
+
final List<Recipe> recipesOfType = ess.getServer().getRecipesFor(itemType);
if (recipesOfType.size() < 1)
{
throw new Exception(_("recipeNone", getMaterialName(itemType)));
}
-
+
if (recipeNo < 0 || recipeNo >= recipesOfType.size())
{
throw new Exception(_("recipeBadIndex"));
}
-
+
final Recipe selectedRecipe = recipesOfType.get(recipeNo);
sender.sendMessage(_("recipe", getMaterialName(itemType), recipeNo + 1, recipesOfType.size()));
-
+
if (selectedRecipe instanceof FurnaceRecipe)
{
furnaceRecipe(sender, (FurnaceRecipe)selectedRecipe);
@@ -71,7 +70,7 @@ public class Commandrecipe extends EssentialsCommand {
shapelessRecipe(sender, (ShapelessRecipe)selectedRecipe);
}
-
+
if (recipesOfType.size() > 1 && args.length == 1)
{
sender.sendMessage(_("recipeMore", commandLabel, args[0], getMaterialName(itemType)));
@@ -86,7 +85,7 @@ public class Commandrecipe extends EssentialsCommand public void shapedRecipe(final CommandSender sender, final ShapedRecipe recipe)
{
final Map<Character, ItemStack> recipeMap = recipe.getIngredientMap();
-
+
if (sender instanceof Player)
{
final User user = ess.getUser(sender);
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index efa37b2eb..a52c5d982 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.NumberUtil; import java.math.BigDecimal; import java.util.Locale; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java index 67e94acc5..390ab6507 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsethome.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.NumberUtil; -import com.earth2me.essentials.utils.StringUtil; import java.util.Locale; import org.bukkit.Location; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index 689ffdfcc..3a1be66d9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.DateUtil; import java.util.GregorianCalendar; import org.bukkit.Server; @@ -47,7 +46,7 @@ public class Commandtempban extends EssentialsCommand final long banTimestamp = DateUtil.parseDateDiff(time, true); final long maxBanLength = ess.getSettings().getMaxTempban() * 1000; - if (maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength) + if (maxBanLength > 0 && ((banTimestamp - GregorianCalendar.getInstance().getTimeInMillis()) > maxBanLength) && sender instanceof Player && !(ess.getUser(sender).isAuthorized("essentials.tempban.unlimited"))) { sender.sendMessage(_("oversizedTempban")); @@ -60,7 +59,7 @@ public class Commandtempban extends EssentialsCommand user.setBanTimeout(banTimestamp); user.setBanned(true); user.kickPlayer(banReason); - + ess.broadcastMessage(sender, "essentials.ban.notify", _("playerBanned", senderName, user.getName(), banReason)); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java index 501d532d4..b0099ada5 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtime.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtime.java @@ -1,10 +1,9 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.utils.DescParseTickFormat; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; +import com.earth2me.essentials.utils.DescParseTickFormat; import com.earth2me.essentials.utils.NumberUtil; -import com.earth2me.essentials.utils.StringUtil; import java.util.*; import org.bukkit.Server; import org.bukkit.World; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java index d5b4ce9f4..4aed22fd1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.DateUtil; import org.bukkit.Server; import org.bukkit.command.CommandSender; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index a0dae971b..e6924a406 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -1,6 +1,5 @@ package com.earth2me.essentials.commands; -import com.earth2me.essentials.ChargeException; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java index 59fe2fb36..3df53d55c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtree.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtree.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.LocationUtil; import org.bukkit.Location; import org.bukkit.Server; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java index c0711b03a..2a37916cf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandunbanip.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; @@ -25,6 +24,7 @@ public class Commandunbanip extends EssentialsCommand { throw new NotEnoughArgumentsException(); } + String ipAddress; if (FormatUtil.validIP(args[0])) { @@ -32,12 +32,20 @@ public class Commandunbanip extends EssentialsCommand } else { - final User user = getPlayer(server, args, 0, true, true); - ipAddress = user.getLastLoginAddress(); - if (ipAddress.isEmpty()) + try { - throw new PlayerNotFoundException(); + User player = getPlayer(server, args, 0, true, true); + ipAddress = player.getLastLoginAddress(); } + catch (PlayerNotFoundException ex) + { + ipAddress = args[0]; + } + } + + if (ipAddress.isEmpty()) + { + throw new PlayerNotFoundException(); } ess.getServer().unbanIP(ipAddress); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java index 7e6ed7332..5b518857c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandwhois.java @@ -2,10 +2,9 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.craftbukkit.SetExpFix; -import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.DateUtil; +import com.earth2me.essentials.utils.NumberUtil; import java.util.Locale; import org.bukkit.Server; import org.bukkit.command.CommandSender; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java index 1509e7235..7754e1c60 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.commands; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.NumberUtil; import java.math.BigDecimal; import java.util.Locale; @@ -48,7 +47,7 @@ public class Commandworth extends EssentialsCommand { throw new Exception(_("itemCannotBeSold")); } - + final BigDecimal result = worth.multiply(BigDecimal.valueOf(amount)); user.sendMessage(iStack.getDurability() != 0 @@ -94,7 +93,7 @@ public class Commandworth extends EssentialsCommand { throw new Exception(_("itemCannotBeSold")); } - + final BigDecimal result = worth.multiply(BigDecimal.valueOf(amount)); sender.sendMessage(iStack.getDurability() != 0 |