blob: 4f276c3b98204de6fcf95605641acd3af86241cc (
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
43
44
45
46
|
package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandxmppspy extends EssentialsCommand
{
public Commandxmppspy()
{
super("xmppspy");
}
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
final List<Player> matches = server.matchPlayer(args[0]);
if (matches.isEmpty())
{
sender.sendMessage("§cThere are no players matching that name.");
}
for (Player p : matches)
{
try
{
final boolean toggle = EssentialsXMPP.getInstance().toggleSpy(p);
sender.sendMessage("XMPP Spy " + (toggle ? "enabled" : "disabled") + " for " + p.getDisplayName());
}
catch (Exception ex)
{
sender.sendMessage("Error: " + ex.getMessage());
}
}
}
}
|