mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-10-03 15:24:21 +00:00
5eeb020f01
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1471 e251c2fe-e539-e718-e476-b85c1f46cddb
47 lines
1,022 B
Java
47 lines
1,022 B
Java
package com.earth2me.essentials.commands;
|
|
|
|
import com.earth2me.essentials.User;
|
|
import com.earth2me.essentials.Util;
|
|
import org.bukkit.Server;
|
|
import org.bukkit.World;
|
|
|
|
|
|
public class Commandweather extends EssentialsCommand
|
|
{
|
|
public Commandweather()
|
|
{
|
|
super("weather");
|
|
}
|
|
|
|
@Override
|
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
|
{
|
|
if (args.length < 1)
|
|
{
|
|
throw new NotEnoughArgumentsException();
|
|
}
|
|
|
|
boolean isStorm = args[0].equalsIgnoreCase("storm");
|
|
World world = user.getWorld();
|
|
user.charge(this);
|
|
if (args.length > 1)
|
|
{
|
|
|
|
world.setStorm(isStorm ? true : false);
|
|
world.setWeatherDuration(Integer.parseInt(args[1]) * 20);
|
|
user.sendMessage(isStorm
|
|
? Util.format("weatherStormFor", args[1])
|
|
: Util.format("weatherSunFor", args[1]));
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
world.setStorm(isStorm ? true : false);
|
|
user.sendMessage(isStorm
|
|
? Util.i18n("weatherStorm")
|
|
: Util.i18n("weatherSun"));
|
|
return;
|
|
}
|
|
}
|
|
}
|