summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/commands/Commandthunder.java
blob: e9e55d72b3ab4c9452b1fe282b836a8adc97b2cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package net.ess3.commands;

import static net.ess3.I18n._;
import net.ess3.api.IUser;
import org.bukkit.World;


public class Commandthunder extends EssentialsCommand
{
	@Override
	public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
	{
		if (args.length < 1)
		{
			throw new NotEnoughArgumentsException();
		}

		final World world = user.getPlayer().getWorld();
		final boolean setThunder = args[0].equalsIgnoreCase("true");
		if (args.length > 1)
		{

			world.setThundering(setThunder ? true : false);
			world.setThunderDuration(Integer.parseInt(args[1]) * 20);
			user.sendMessage(_("§6You§c {0} §6thunder in your world for§c {1} §6seconds.", (setThunder ? _("enabled") : _("disabled")), Integer.parseInt(args[1])));

		}
		else
		{
			world.setThundering(setThunder ? true : false);
			user.sendMessage(_(" §6You§c {0} §6thunder in your world.", setThunder ? _("enabled") : _("disabled")));
		}

	}
}