blob: 9b3ff71cc1357d2871ac1db8a77b5f2ea05c2aec (
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
38
39
40
41
42
|
package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IUser;
public class Commandignore extends EssentialsCommand
{
@Override
protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
IUser player;
try
{
player = getPlayer(args, 0);
}
catch (NoSuchFieldException ex)
{
player = ess.getUser(args[0]);
}
if (player == null)
{
throw new Exception(_("playerNotFound"));
}
final String name = player.getName();
user.acquireWriteLock();
if (user.isIgnoringPlayer(name))
{
user.setIgnoredPlayer(name, false);
user.sendMessage(_("unignorePlayer", player.getName()));
}
else
{
user.setIgnoredPlayer(name, true);
user.sendMessage(_("ignorePlayer", player.getName()));
}
}
}
|