Minor fixes. Basic testing shows all works.

This commit is contained in:
Tim P 2011-10-18 23:08:06 -04:00
parent 6ab30159fa
commit 82b225a261
2 changed files with 26 additions and 6 deletions

View File

@ -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();
}

View File

@ -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");