blob: e7dd01670deed7ab071debde1e3ff7bafb8e8dd1 (
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.xmpp;
import com.earth2me.essentials.Console;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandxmpp extends EssentialsCommand
{
public Commandxmpp()
{
super("xmpp");
}
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String address = EssentialsXMPP.getInstance().getAddress(args[0]);
if (address == null)
{
sender.sendMessage("§cThere are no players matching that name.");
}
else
{
final String message = getFinalArg(args, 1);
final String senderName = sender instanceof Player ? ess.getUser(sender).getDisplayName() : Console.NAME;
sender.sendMessage("[" + senderName + ">" + address + "] " + message);
if (!EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message))
{
sender.sendMessage("§cError sending message.");
}
}
}
}
|