Fix /day /night /sun and /storm aliases to actually set to the current status if used without parameters.

fixes #2365
This commit is contained in:
KHobbits 2012-08-08 00:52:43 +01:00
parent 5c1eea0953
commit 101ae201d6
3 changed files with 54 additions and 15 deletions

View file

@ -18,12 +18,27 @@ public class Commandweather extends EssentialsCommand
@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
final boolean isStorm;
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
if (commandLabel.equalsIgnoreCase("sun") || commandLabel.equalsIgnoreCase("esun"))
{
isStorm = false;
}
else if (commandLabel.equalsIgnoreCase("storm") || commandLabel.equalsIgnoreCase("estorm")
|| commandLabel.equalsIgnoreCase("rain") || commandLabel.equalsIgnoreCase("erain"))
{
isStorm = true;
}
else
{
throw new NotEnoughArgumentsException();
}
}
else
{
isStorm = args[0].equalsIgnoreCase("storm");
}
final boolean isStorm = args[0].equalsIgnoreCase("storm");
final World world = user.getWorld();
if (args.length > 1)
{