2011-04-23 00:43:27 +00:00
|
|
|
package com.earth2me.essentials.commands;
|
|
|
|
|
|
|
|
import com.earth2me.essentials.Essentials;
|
|
|
|
import com.earth2me.essentials.User;
|
|
|
|
|
|
|
|
import org.bukkit.Server;
|
2011-04-26 12:13:39 +00:00
|
|
|
import org.bukkit.World;
|
|
|
|
|
2011-04-23 00:43:27 +00:00
|
|
|
|
|
|
|
public class Commandthunder extends EssentialsCommand
|
|
|
|
{
|
2011-04-26 12:13:39 +00:00
|
|
|
public Commandthunder()
|
2011-04-23 00:43:27 +00:00
|
|
|
{
|
|
|
|
super("thunder");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception
|
|
|
|
{
|
2011-04-26 12:13:39 +00:00
|
|
|
|
|
|
|
if (args.length < 1)
|
|
|
|
{
|
|
|
|
user.sendMessage("§cUsage: /" + commandLabel + " <true/false> [duration]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
user.charge(this);
|
|
|
|
World world = user.getWorld();
|
|
|
|
boolean setThunder = args[0].equalsIgnoreCase("true");
|
2011-04-26 22:46:34 +00:00
|
|
|
if (args.length > 1)
|
2011-04-26 12:13:39 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
world.setThundering(setThunder ? true : false);
|
|
|
|
world.setThunderDuration(Integer.parseInt(args[1]) * 20);
|
|
|
|
user.sendMessage("§7You " + (setThunder ? "enabled" : "disabled") + " thunder in your world for " + args[1] + " seconds");
|
2011-04-28 00:32:47 +00:00
|
|
|
return;
|
2011-04-26 12:13:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
world.setThundering(setThunder ? true : false);
|
|
|
|
user.sendMessage("§7You " + (setThunder ? "enabled" : "disabled") + " thunder in your world");
|
2011-04-28 00:32:47 +00:00
|
|
|
return;
|
2011-04-26 12:13:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2011-04-23 00:43:27 +00:00
|
|
|
}
|