From f1eae9be6f40704e3ab00fd3693f058013886c8d Mon Sep 17 00:00:00 2001 From: Iaccidentally Date: Sun, 9 Jun 2013 16:35:51 -0400 Subject: Cleanup imports --- .../src/com/earth2me/essentials/Enchantments.java | 47 +++++++++++----------- .../essentials/EssentialsBlockListener.java | 3 +- .../src/com/earth2me/essentials/MetaItemStack.java | 1 - .../src/com/earth2me/essentials/Potions.java | 41 +++++++++---------- .../essentials/commands/Commandantioch.java | 3 +- .../essentials/commands/Commandbalance.java | 1 - .../essentials/commands/Commandbalancetop.java | 1 - .../earth2me/essentials/commands/Commandban.java | 1 - .../earth2me/essentials/commands/Commandbanip.java | 25 ++++++++---- .../essentials/commands/Commandbigtree.java | 1 - .../essentials/commands/Commandbroadcast.java | 1 - .../essentials/commands/Commandclearinventory.java | 1 - .../earth2me/essentials/commands/Commandeco.java | 1 - .../essentials/commands/Commandessentials.java | 5 +-- .../earth2me/essentials/commands/Commandexp.java | 1 - .../essentials/commands/Commandfirework.java | 1 - .../earth2me/essentials/commands/Commandgc.java | 3 +- .../earth2me/essentials/commands/Commandhelp.java | 1 - .../essentials/commands/Commandhelpop.java | 1 - .../earth2me/essentials/commands/Commandjump.java | 1 - .../earth2me/essentials/commands/Commandkick.java | 1 - .../essentials/commands/Commandkickall.java | 1 - .../earth2me/essentials/commands/Commandlist.java | 1 - .../earth2me/essentials/commands/Commandme.java | 9 ++--- .../earth2me/essentials/commands/Commandmsg.java | 1 - .../earth2me/essentials/commands/Commandmute.java | 1 - .../earth2me/essentials/commands/Commandnick.java | 1 - .../earth2me/essentials/commands/Commandping.java | 1 - .../com/earth2me/essentials/commands/Commandr.java | 3 +- .../essentials/commands/Commandrealname.java | 1 - .../essentials/commands/Commandrecipe.java | 17 ++++---- .../earth2me/essentials/commands/Commandsell.java | 1 - .../essentials/commands/Commandsethome.java | 1 - .../essentials/commands/Commandtempban.java | 5 +-- .../earth2me/essentials/commands/Commandtime.java | 3 +- .../essentials/commands/Commandtogglejail.java | 1 - .../essentials/commands/Commandtpaccept.java | 1 - .../earth2me/essentials/commands/Commandtree.java | 1 - .../essentials/commands/Commandunbanip.java | 18 ++++++--- .../earth2me/essentials/commands/Commandwhois.java | 3 +- .../earth2me/essentials/commands/Commandworth.java | 5 +-- .../essentials/perm/PermissionsHandler.java | 3 -- .../com/earth2me/essentials/signs/SignBalance.java | 1 - .../essentials/signs/SignBlockListener.java | 5 +-- .../essentials/storage/BukkitConstructor.java | 1 - .../essentials/textreader/KeywordReplacer.java | 7 ++-- .../com/earth2me/essentials/utils/FormatUtil.java | 8 ++-- 47 files changed, 106 insertions(+), 135 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Enchantments.java b/Essentials/src/com/earth2me/essentials/Enchantments.java index 870cc6436..e688355a8 100644 --- a/Essentials/src/com/earth2me/essentials/Enchantments.java +++ b/Essentials/src/com/earth2me/essentials/Enchantments.java @@ -1,7 +1,6 @@ package com.earth2me.essentials; import com.earth2me.essentials.utils.NumberUtil; -import com.earth2me.essentials.utils.StringUtil; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -22,80 +21,80 @@ public class Enchantments ENCHANTMENTS.put("sharpness", Enchantment.DAMAGE_ALL); ALIASENCHANTMENTS.put("sharp", Enchantment.DAMAGE_ALL); ALIASENCHANTMENTS.put("dal", Enchantment.DAMAGE_ALL); - + ENCHANTMENTS.put("ardmg", Enchantment.DAMAGE_ARTHROPODS); ENCHANTMENTS.put("baneofarthropods", Enchantment.DAMAGE_ARTHROPODS); ALIASENCHANTMENTS.put("baneofarthropod", Enchantment.DAMAGE_ARTHROPODS); ALIASENCHANTMENTS.put("arthropod", Enchantment.DAMAGE_ARTHROPODS); ALIASENCHANTMENTS.put("dar", Enchantment.DAMAGE_ARTHROPODS); - + ENCHANTMENTS.put("undeaddamage", Enchantment.DAMAGE_UNDEAD); ENCHANTMENTS.put("smite", Enchantment.DAMAGE_UNDEAD); ALIASENCHANTMENTS.put("du", Enchantment.DAMAGE_UNDEAD); - + ENCHANTMENTS.put("digspeed", Enchantment.DIG_SPEED); ENCHANTMENTS.put("efficiency", Enchantment.DIG_SPEED); ALIASENCHANTMENTS.put("minespeed", Enchantment.DIG_SPEED); ALIASENCHANTMENTS.put("cutspeed", Enchantment.DIG_SPEED); ALIASENCHANTMENTS.put("ds", Enchantment.DIG_SPEED); ALIASENCHANTMENTS.put("eff", Enchantment.DIG_SPEED); - + ENCHANTMENTS.put("durability", Enchantment.DURABILITY); ALIASENCHANTMENTS.put("dura", Enchantment.DURABILITY); ENCHANTMENTS.put("unbreaking", Enchantment.DURABILITY); ALIASENCHANTMENTS.put("d", Enchantment.DURABILITY); - + ENCHANTMENTS.put("thorns", Enchantment.THORNS); ENCHANTMENTS.put("highcrit", Enchantment.THORNS); ALIASENCHANTMENTS.put("thorn", Enchantment.THORNS); ALIASENCHANTMENTS.put("highercrit", Enchantment.THORNS); ALIASENCHANTMENTS.put("t", Enchantment.THORNS); - + ENCHANTMENTS.put("fireaspect", Enchantment.FIRE_ASPECT); ENCHANTMENTS.put("fire", Enchantment.FIRE_ASPECT); ALIASENCHANTMENTS.put("meleefire", Enchantment.FIRE_ASPECT); ALIASENCHANTMENTS.put("meleeflame", Enchantment.FIRE_ASPECT); ALIASENCHANTMENTS.put("fa", Enchantment.FIRE_ASPECT); - + ENCHANTMENTS.put("knockback", Enchantment.KNOCKBACK); ALIASENCHANTMENTS.put("kback", Enchantment.KNOCKBACK); ALIASENCHANTMENTS.put("kb", Enchantment.KNOCKBACK); ALIASENCHANTMENTS.put("k", Enchantment.KNOCKBACK); - + ALIASENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS); ENCHANTMENTS.put("fortune", Enchantment.LOOT_BONUS_BLOCKS); ALIASENCHANTMENTS.put("fort", Enchantment.LOOT_BONUS_BLOCKS); ALIASENCHANTMENTS.put("lbb", Enchantment.LOOT_BONUS_BLOCKS); - + ALIASENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS); ENCHANTMENTS.put("mobloot", Enchantment.LOOT_BONUS_MOBS); ENCHANTMENTS.put("looting", Enchantment.LOOT_BONUS_MOBS); ALIASENCHANTMENTS.put("lbm", Enchantment.LOOT_BONUS_MOBS); - + ALIASENCHANTMENTS.put("oxygen", Enchantment.OXYGEN); ENCHANTMENTS.put("respiration", Enchantment.OXYGEN); ALIASENCHANTMENTS.put("breathing", Enchantment.OXYGEN); ENCHANTMENTS.put("breath", Enchantment.OXYGEN); ALIASENCHANTMENTS.put("o", Enchantment.OXYGEN); - + ENCHANTMENTS.put("protection", Enchantment.PROTECTION_ENVIRONMENTAL); ALIASENCHANTMENTS.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL); ENCHANTMENTS.put("protect", Enchantment.PROTECTION_ENVIRONMENTAL); ALIASENCHANTMENTS.put("p", Enchantment.PROTECTION_ENVIRONMENTAL); - + ALIASENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS); ALIASENCHANTMENTS.put("explosionprotection", Enchantment.PROTECTION_EXPLOSIONS); ALIASENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS); ALIASENCHANTMENTS.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS); ENCHANTMENTS.put("blastprotect", Enchantment.PROTECTION_EXPLOSIONS); ALIASENCHANTMENTS.put("pe", Enchantment.PROTECTION_EXPLOSIONS); - + ALIASENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL); ENCHANTMENTS.put("fallprot", Enchantment.PROTECTION_FALL); ENCHANTMENTS.put("featherfall", Enchantment.PROTECTION_FALL); ALIASENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL); ALIASENCHANTMENTS.put("pfa", Enchantment.PROTECTION_FALL); - + ALIASENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE); ALIASENCHANTMENTS.put("flameprotection", Enchantment.PROTECTION_FIRE); ENCHANTMENTS.put("fireprotect", Enchantment.PROTECTION_FIRE); @@ -103,45 +102,45 @@ public class Enchantments ENCHANTMENTS.put("fireprot", Enchantment.PROTECTION_FIRE); ALIASENCHANTMENTS.put("flameprot", Enchantment.PROTECTION_FIRE); ALIASENCHANTMENTS.put("pf", Enchantment.PROTECTION_FIRE); - + ENCHANTMENTS.put("projectileprotection", Enchantment.PROTECTION_PROJECTILE); ENCHANTMENTS.put("projprot", Enchantment.PROTECTION_PROJECTILE); ALIASENCHANTMENTS.put("pp", Enchantment.PROTECTION_PROJECTILE); - + ENCHANTMENTS.put("silktouch", Enchantment.SILK_TOUCH); ALIASENCHANTMENTS.put("softtouch", Enchantment.SILK_TOUCH); ALIASENCHANTMENTS.put("st", Enchantment.SILK_TOUCH); - + ENCHANTMENTS.put("waterworker", Enchantment.WATER_WORKER); ENCHANTMENTS.put("aquaaffinity", Enchantment.WATER_WORKER); ALIASENCHANTMENTS.put("watermine", Enchantment.WATER_WORKER); ALIASENCHANTMENTS.put("ww", Enchantment.WATER_WORKER); - + ALIASENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE); ENCHANTMENTS.put("flame", Enchantment.ARROW_FIRE); ENCHANTMENTS.put("flamearrow", Enchantment.ARROW_FIRE); ALIASENCHANTMENTS.put("af", Enchantment.ARROW_FIRE); - + ENCHANTMENTS.put("arrowdamage", Enchantment.ARROW_DAMAGE); ENCHANTMENTS.put("power", Enchantment.ARROW_DAMAGE); ALIASENCHANTMENTS.put("arrowpower", Enchantment.ARROW_DAMAGE); ALIASENCHANTMENTS.put("ad", Enchantment.ARROW_DAMAGE); - + ENCHANTMENTS.put("arrowknockback", Enchantment.ARROW_KNOCKBACK); ALIASENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK); ENCHANTMENTS.put("punch", Enchantment.ARROW_KNOCKBACK); ALIASENCHANTMENTS.put("arrowpunch", Enchantment.ARROW_KNOCKBACK); ALIASENCHANTMENTS.put("ak", Enchantment.ARROW_KNOCKBACK); - + ALIASENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE); ENCHANTMENTS.put("infarrows", Enchantment.ARROW_INFINITE); ENCHANTMENTS.put("infinity", Enchantment.ARROW_INFINITE); ALIASENCHANTMENTS.put("infinite", Enchantment.ARROW_INFINITE); ALIASENCHANTMENTS.put("unlimited", Enchantment.ARROW_INFINITE); ALIASENCHANTMENTS.put("unlimitedarrows", Enchantment.ARROW_INFINITE); - ALIASENCHANTMENTS.put("ai", Enchantment.ARROW_INFINITE); + ALIASENCHANTMENTS.put("ai", Enchantment.ARROW_INFINITE); } - + public static Enchantment getByName(String name) { Enchantment enchantment; if (NumberUtil.isInt(name)) { diff --git a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java index a71bf5c4a..1dd37ef2d 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsBlockListener.java @@ -1,7 +1,6 @@ package com.earth2me.essentials; import com.earth2me.essentials.utils.LocationUtil; -import com.earth2me.essentials.utils.StringUtil; import org.bukkit.GameMode; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -23,7 +22,7 @@ public class EssentialsBlockListener implements Listener public void onBlockPlace(final BlockPlaceEvent event) { // Do not rely on getItemInHand(); - // http://leaky.bukkit.org/issues/663 + // http://leaky.bukkit.org/issues/663 final ItemStack is = LocationUtil.convertBlockToItem(event.getBlockPlaced()); if (is == null) { diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java index 352f85330..ffe39d080 100644 --- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java +++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java @@ -1,6 +1,5 @@ package com.earth2me.essentials; -import com.earth2me.essentials.utils.StringUtil; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.textreader.BookInput; import com.earth2me.essentials.textreader.BookPager; diff --git a/Essentials/src/com/earth2me/essentials/Potions.java b/Essentials/src/com/earth2me/essentials/Potions.java index 733a36638..db6f47c93 100644 --- a/Essentials/src/com/earth2me/essentials/Potions.java +++ b/Essentials/src/com/earth2me/essentials/Potions.java @@ -1,7 +1,6 @@ package com.earth2me.essentials; import com.earth2me.essentials.utils.NumberUtil; -import com.earth2me.essentials.utils.StringUtil; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -17,88 +16,88 @@ public class Potions static { - + POTIONS.put("speed", PotionEffectType.SPEED); ALIASPOTIONS.put("fast", PotionEffectType.SPEED); ALIASPOTIONS.put("runfast", PotionEffectType.SPEED); ALIASPOTIONS.put("sprint", PotionEffectType.SPEED); ALIASPOTIONS.put("swift", PotionEffectType.SPEED); - + POTIONS.put("slowness", PotionEffectType.SLOW); ALIASPOTIONS.put("slow", PotionEffectType.SLOW); ALIASPOTIONS.put("sluggish", PotionEffectType.SLOW); - + POTIONS.put("haste", PotionEffectType.FAST_DIGGING); ALIASPOTIONS.put("superpick", PotionEffectType.FAST_DIGGING); ALIASPOTIONS.put("quickmine", PotionEffectType.FAST_DIGGING); ALIASPOTIONS.put("digspeed", PotionEffectType.FAST_DIGGING); ALIASPOTIONS.put("digfast", PotionEffectType.FAST_DIGGING); ALIASPOTIONS.put("sharp", PotionEffectType.FAST_DIGGING); - + POTIONS.put("fatigue", PotionEffectType.SLOW_DIGGING); ALIASPOTIONS.put("slow", PotionEffectType.SLOW_DIGGING); ALIASPOTIONS.put("dull", PotionEffectType.SLOW_DIGGING); - + POTIONS.put("strength", PotionEffectType.INCREASE_DAMAGE); ALIASPOTIONS.put("strong", PotionEffectType.INCREASE_DAMAGE); ALIASPOTIONS.put("bull", PotionEffectType.INCREASE_DAMAGE); ALIASPOTIONS.put("attack", PotionEffectType.INCREASE_DAMAGE); - + POTIONS.put("heal", PotionEffectType.HEAL); ALIASPOTIONS.put("healthy", PotionEffectType.HEAL); ALIASPOTIONS.put("instaheal", PotionEffectType.HEAL); - + POTIONS.put("harm", PotionEffectType.HARM); ALIASPOTIONS.put("harming", PotionEffectType.HARM); ALIASPOTIONS.put("injure", PotionEffectType.HARM); ALIASPOTIONS.put("damage", PotionEffectType.HARM); ALIASPOTIONS.put("inflict", PotionEffectType.HARM); - + POTIONS.put("jump", PotionEffectType.JUMP); ALIASPOTIONS.put("leap", PotionEffectType.JUMP); - + POTIONS.put("nausea", PotionEffectType.CONFUSION); ALIASPOTIONS.put("sick", PotionEffectType.CONFUSION); ALIASPOTIONS.put("sickness", PotionEffectType.CONFUSION); ALIASPOTIONS.put("confusion", PotionEffectType.CONFUSION); - + POTIONS.put("regeneration", PotionEffectType.REGENERATION); ALIASPOTIONS.put("regen", PotionEffectType.REGENERATION); - + POTIONS.put("resistance", PotionEffectType.DAMAGE_RESISTANCE); ALIASPOTIONS.put("dmgresist", PotionEffectType.DAMAGE_RESISTANCE); ALIASPOTIONS.put("armor", PotionEffectType.DAMAGE_RESISTANCE); ALIASPOTIONS.put("dmgresist", PotionEffectType.DAMAGE_RESISTANCE); - + POTIONS.put("fireresist", PotionEffectType.FIRE_RESISTANCE); ALIASPOTIONS.put("fireresistance", PotionEffectType.FIRE_RESISTANCE); ALIASPOTIONS.put("resistfire", PotionEffectType.FIRE_RESISTANCE); - + POTIONS.put("waterbreath", PotionEffectType.WATER_BREATHING); ALIASPOTIONS.put("waterbreathing", PotionEffectType.WATER_BREATHING); - + POTIONS.put("invisibility", PotionEffectType.INVISIBILITY); ALIASPOTIONS.put("invisible", PotionEffectType.INVISIBILITY); ALIASPOTIONS.put("invis", PotionEffectType.INVISIBILITY); ALIASPOTIONS.put("vanish", PotionEffectType.INVISIBILITY); ALIASPOTIONS.put("disappear", PotionEffectType.INVISIBILITY); - + POTIONS.put("blindness", PotionEffectType.BLINDNESS); ALIASPOTIONS.put("blind", PotionEffectType.BLINDNESS); - + POTIONS.put("nightvision", PotionEffectType.NIGHT_VISION); ALIASPOTIONS.put("vision", PotionEffectType.NIGHT_VISION); - + POTIONS.put("hunger", PotionEffectType.HUNGER); ALIASPOTIONS.put("hungry", PotionEffectType.HUNGER); ALIASPOTIONS.put("starve", PotionEffectType.HUNGER); - + POTIONS.put("weakness", PotionEffectType.WEAKNESS); ALIASPOTIONS.put("weak", PotionEffectType.WEAKNESS); - + POTIONS.put("poison", PotionEffectType.POISON); ALIASPOTIONS.put("venom", PotionEffectType.POISON); - + POTIONS.put("wither", PotionEffectType.WITHER); ALIASPOTIONS.put("decay", PotionEffectType.WITHER); } 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 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 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 diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java index ef32f8e3e..044fbb913 100644 --- a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java @@ -1,7 +1,5 @@ package com.earth2me.essentials.perm; -import com.earth2me.essentials.utils.NumberUtil; -import com.earth2me.essentials.utils.StringUtil; import java.util.Collections; import java.util.List; import java.util.logging.Level; @@ -166,7 +164,6 @@ public class PermissionsHandler implements IPermissionsHandler handler = new BPermissions2Handler(); } return; - } if (useSuperperms) diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBalance.java b/Essentials/src/com/earth2me/essentials/signs/SignBalance.java index 2cd339c69..e47ff394d 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignBalance.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignBalance.java @@ -3,7 +3,6 @@ package com.earth2me.essentials.signs; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.NumberUtil; diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java index 207d0d6e2..345d4747f 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import java.util.logging.Logger; @@ -51,7 +50,7 @@ public class SignBlockListener implements Listener LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign."); return true; } - + final int mat = block.getTypeId(); if (mat == SIGN_POST || mat == WALL_SIGN) { @@ -66,7 +65,7 @@ public class SignBlockListener implements Listener } } } - + for (EssentialsSign sign : ess.getSettings().enabledSigns()) { if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType()) diff --git a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java index 674829818..cf0a656a6 100644 --- a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java +++ b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java @@ -1,7 +1,6 @@ package com.earth2me.essentials.storage; import com.earth2me.essentials.utils.NumberUtil; -import com.earth2me.essentials.utils.StringUtil; import java.lang.reflect.Field; import java.util.List; import java.util.Locale; diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java index a1c71ef39..c3790414a 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java @@ -1,9 +1,8 @@ package com.earth2me.essentials.textreader; -import com.earth2me.essentials.utils.DescParseTickFormat; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.StringUtil; +import com.earth2me.essentials.utils.DescParseTickFormat; import com.earth2me.essentials.utils.NumberUtil; import java.text.DateFormat; import java.util.ArrayList; @@ -21,7 +20,7 @@ public class KeywordReplacer implements IText private final transient IText input; private final transient List replaced; private final transient IEssentials ess; - + public KeywordReplacer(final IText input, final CommandSender sender, final IEssentials ess) { this.input = input; @@ -29,7 +28,7 @@ public class KeywordReplacer implements IText this.ess = ess; replaceKeywords(sender); } - + private void replaceKeywords(final CommandSender sender) { String displayName, ipAddress, balance, mails, world; diff --git a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java index f47ff3296..effcf88ce 100644 --- a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java @@ -6,12 +6,12 @@ import java.util.regex.Pattern; public class FormatUtil { - static final transient Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-f])"); + static final transient Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-fA-F])"); static final transient Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00a7+[Kk]"); static final transient Pattern VANILLA_FORMAT_PATTERN = Pattern.compile("\u00a7+[L-ORl-or]"); - static final transient Pattern REPLACE_FORMAT_PATTERN = Pattern.compile("&([l-or])"); - static final transient Pattern REPLACE_MAGIC_PATTERN = Pattern.compile("&(k)"); - static final transient Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])"); + static final transient Pattern REPLACE_FORMAT_PATTERN = Pattern.compile("&([l-orL-OR])"); + static final transient Pattern REPLACE_MAGIC_PATTERN = Pattern.compile("&([Kk])"); + static final transient Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-orA-FK-OR])"); static final transient Pattern LOGCOLOR_PATTERN = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]"); static final transient Pattern VANILLA_PATTERN = Pattern.compile("\u00a7+[0-9A-FK-ORa-fk-or]?"); static final transient Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00a7+[0-9A-Fa-f]"); -- cgit v1.2.3