mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 20:12:54 +00:00
Cleanup
This commit is contained in:
parent
1c7dcfc63d
commit
358456c8ea
4 changed files with 44 additions and 36 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue