summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java
blob: ff4ca2adac0738acfe48e6fd8b57cbdfbc00e1bf (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 com.earth2me.essentials.commands;

import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.permissions.Permissions;
import org.bukkit.entity.Player;


public class Commandvanish extends EssentialsCommand
{
	@Override
	protected void run(IUser user, String commandLabel, String[] args) throws Exception
	{
		if (user.isVanished())
		{
			for (Player p : server.getOnlinePlayers())
			{
				p.showPlayer(user);
			}
			user.sendMessage(_("vanished"));
		}
		else
		{
			for (Player p : server.getOnlinePlayers())
			{
				if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(p))
				{
					p.hidePlayer(user);
				}
				user.sendMessage(_("unvanished"));
			}
		}
		user.toggleVanished();
	}
}