summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/commands/Commandme.java
blob: 087b22b1365273496e0d74221f2832e41efa459c (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
36
37
package net.ess3.commands;

import static net.ess3.I18n._;
import net.ess3.api.IUser;
import net.ess3.permissions.Permissions;
import net.ess3.utils.Util;


public class Commandme extends EssentialsCommand
{
	@Override
	public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
	{
		if (user.getData().isMuted())
		{
			throw new Exception(_("voiceSilenced"));
		}

		if (args.length < 1)
		{
			throw new NotEnoughArgumentsException();
		}

		String message = getFinalArg(args, 0);
		if (Permissions.CHAT_COLOR.isAuthorized(user))
		{
			message = Util.replaceFormat(message);
		}
		else {
			message = Util.stripColor(message);
		}
		

		user.setDisplayNick();
		ess.broadcastMessage(user, _("action", user.getPlayer().getDisplayName(), message));
	}
}