diff options
author | snowleo <schneeleo@gmail.com> | 2011-10-19 14:47:32 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-10-19 14:47:32 +0200 |
commit | 358456c8ea83df2e99b436799672c1229e604181 (patch) | |
tree | 20d09d09c56c3585ccbd54239a32ff291a5a428d | |
parent | 1c7dcfc63dbdf4d01cd342d28df0e27851078467 (diff) | |
download | Essentials-358456c8ea83df2e99b436799672c1229e604181.tar Essentials-358456c8ea83df2e99b436799672c1229e604181.tar.gz Essentials-358456c8ea83df2e99b436799672c1229e604181.tar.lz Essentials-358456c8ea83df2e99b436799672c1229e604181.tar.xz Essentials-358456c8ea83df2e99b436799672c1229e604181.zip |
Cleanup
4 files changed, 44 insertions, 36 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index d7d33d469..ddc26aadc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -70,15 +70,17 @@ public class Commandmail extends EssentialsCommand } throw new NotEnoughArgumentsException(); } - - @Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { + + @Override + protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { if (args.length >= 1 && "read".equalsIgnoreCase(args[0])) { - throw new Exception(Util.format("onlyPlayers", commandLabel+" read")); + throw new Exception(Util.format("onlyPlayers", commandLabel + " read")); } else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) { - throw new Exception(Util.format("onlyPlayers", commandLabel+" clear")); + throw new Exception(Util.format("onlyPlayers", commandLabel + " clear")); } else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { @@ -99,9 +101,10 @@ public class Commandmail extends EssentialsCommand u.addMail("Server: " + getFinalArg(args, 2)); sender.sendMessage(Util.i18n("mailSent")); return; - } - else if (args.length >= 2) - { //allow sending from console without "send" argument, since it's the only thing the console can do + } + else if (args.length >= 2) + { + //allow sending from console without "send" argument, since it's the only thing the console can do Player player = server.getPlayer(args[0]); User u; if (player != null) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java index 7265dd546..5ed4ef9e6 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrealname.java @@ -14,9 +14,10 @@ public class Commandrealname extends EssentialsCommand { super("realname"); } - - @Override - protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { + + @Override + protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { if (args.length < 1) { throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java index 0201d594b..9603e9f72 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java @@ -43,35 +43,37 @@ public class Commandweather extends EssentialsCommand return; } } - - @Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { + + @Override + protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { if (args.length < 2) //running from console means inserting a world arg before other args { - throw new Exception("When running from console, usage is: /"+commandLabel+" <world> <storm/sun> [duration]"); + throw new Exception("When running from console, usage is: /" + commandLabel + " <world> <storm/sun> [duration]"); } boolean isStorm = args[1].equalsIgnoreCase("storm"); World world = server.getWorld(args[0]); if (world == null) { - throw new Exception("World named "+args[0]+" not found!"); + throw new Exception("World named " + args[0] + " not found!"); } if (args.length > 2) { world.setStorm(isStorm ? true : false); - world.setWeatherDuration(Integer.parseInt(args[1]) * 20); + world.setWeatherDuration(Integer.parseInt(args[2]) * 20); sender.sendMessage(isStorm - ? Util.format("weatherStormFor", world.getName(), args[1]) - : Util.format("weatherSunFor", world.getName(), args[1])); + ? Util.format("weatherStormFor", world.getName(), args[2]) + : Util.format("weatherSunFor", world.getName(), args[2])); return; } else { world.setStorm(isStorm ? true : false); sender.sendMessage(isStorm - ? Util.format("weatherStorm", world.getName()) - : Util.format("weatherSun", world.getName())); + ? Util.format("weatherStorm", world.getName()) + : Util.format("weatherSun", world.getName())); return; } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java index 6ca894f4b..2a7e107bc 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java @@ -35,7 +35,7 @@ public class Commandworth extends EssentialsCommand } catch (NumberFormatException ex) { - amount = 64; + amount = is.getType().getMaxStackSize(); } is.setAmount(amount); @@ -58,14 +58,16 @@ public class Commandworth extends EssentialsCommand amount, Util.formatCurrency(worth, ess))); } - - @Override protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception { + + @Override + protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { if (args.length < 1) { throw new NotEnoughArgumentsException(); } - - ItemStack is = ess.getItemDb().get(args[0]);// = user.getInventory().getItemInHand(); + + ItemStack is = ess.getItemDb().get(args[0]); int amount = is.getAmount(); try @@ -77,7 +79,7 @@ public class Commandworth extends EssentialsCommand } catch (NumberFormatException ex) { - amount = 64; + amount = is.getType().getMaxStackSize(); } is.setAmount(amount); @@ -88,17 +90,17 @@ public class Commandworth extends EssentialsCommand } sender.sendMessage(is.getDurability() != 0 - ? Util.format("worthMeta", - is.getType().toString().toLowerCase().replace("_", ""), - is.getDurability(), - Util.formatCurrency(worth * amount, ess), - amount, - Util.formatCurrency(worth, ess)) - : Util.format("worth", - is.getType().toString().toLowerCase().replace("_", ""), - Util.formatCurrency(worth * amount, ess), - amount, - Util.formatCurrency(worth, ess))); + ? Util.format("worthMeta", + is.getType().toString().toLowerCase().replace("_", ""), + is.getDurability(), + Util.formatCurrency(worth * amount, ess), + amount, + Util.formatCurrency(worth, ess)) + : Util.format("worth", + is.getType().toString().toLowerCase().replace("_", ""), + Util.formatCurrency(worth * amount, ess), + amount, + Util.formatCurrency(worth, ess))); } } |