diff options
author | Tim P <tustin2121@gmail.com> | 2011-10-18 23:08:06 -0400 |
---|---|---|
committer | Tim P <tustin2121@gmail.com> | 2011-10-18 23:08:06 -0400 |
commit | 35121d9c4b329cbfbe47872e6c92ba1f6990d193 (patch) | |
tree | 074a33e2e5f000d0461b05b1d1b76053e2363207 | |
parent | e96d33cb8b5a71a66b07c64700307b0a1b04edaf (diff) | |
download | Essentials-35121d9c4b329cbfbe47872e6c92ba1f6990d193.tar Essentials-35121d9c4b329cbfbe47872e6c92ba1f6990d193.tar.gz Essentials-35121d9c4b329cbfbe47872e6c92ba1f6990d193.tar.lz Essentials-35121d9c4b329cbfbe47872e6c92ba1f6990d193.tar.xz Essentials-35121d9c4b329cbfbe47872e6c92ba1f6990d193.zip |
Minor fixes. Basic testing shows all works.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandmail.java | 30 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandweather.java | 2 |
2 files changed, 26 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java index a241c787a..d7d33d469 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmail.java @@ -76,7 +76,11 @@ public class Commandmail extends EssentialsCommand { throw new Exception(Util.format("onlyPlayers", commandLabel+" read")); } - if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) + else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) + { + throw new Exception(Util.format("onlyPlayers", commandLabel+" clear")); + } + else if (args.length >= 3 && "send".equalsIgnoreCase(args[0])) { Player player = server.getPlayer(args[1]); User u; @@ -95,10 +99,26 @@ public class Commandmail extends EssentialsCommand u.addMail("Server: " + getFinalArg(args, 2)); sender.sendMessage(Util.i18n("mailSent")); return; - } - if (args.length >= 1 && "clear".equalsIgnoreCase(args[0])) - { - throw new Exception(Util.format("onlyPlayers", commandLabel+" clear")); + } + 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) + { + u = ess.getUser(player); + } + else + { + u = ess.getOfflineUser(args[0]); + } + if (u == null) + { + throw new Exception(Util.format("playerNeverOnServer", args[0])); + } + u.addMail("Server: " + getFinalArg(args, 1)); + sender.sendMessage(Util.i18n("mailSent")); + return; } throw new NotEnoughArgumentsException(); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java index d5d899b09..0201d594b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandweather.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandweather.java @@ -47,7 +47,7 @@ public class Commandweather extends EssentialsCommand @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 NotEnoughArgumentsException(); + throw new Exception("When running from console, usage is: /"+commandLabel+" <world> <storm/sun> [duration]"); } boolean isStorm = args[1].equalsIgnoreCase("storm"); |