diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-06-02 13:24:26 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-06-02 13:24:26 +0000 |
commit | a235f350ccfa53c48a0a3655aa6c0bf1ea382a04 (patch) | |
tree | e7bc836b7584e7d2f4901b3f9baf256cc76728cb /EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java | |
parent | 395f65dc4a81fc8985f7852b4e783ab18959351d (diff) | |
download | Essentials-a235f350ccfa53c48a0a3655aa6c0bf1ea382a04.tar Essentials-a235f350ccfa53c48a0a3655aa6c0bf1ea382a04.tar.gz Essentials-a235f350ccfa53c48a0a3655aa6c0bf1ea382a04.tar.lz Essentials-a235f350ccfa53c48a0a3655aa6c0bf1ea382a04.tar.xz Essentials-a235f350ccfa53c48a0a3655aa6c0bf1ea382a04.zip |
Added EssentialsXMPP from newplugins branch.
Updated to work with trunk.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1564 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java')
-rw-r--r-- | EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java new file mode 100644 index 000000000..49aa2a6ea --- /dev/null +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java @@ -0,0 +1,39 @@ +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(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { + if (args.length < 2) + { + throw new NotEnoughArgumentsException(); + } + + final String message = getFinalArg(args, 1); + final String address = EssentialsXMPP.getInstance().getAddress(args[0]); + if (address == null) + { + sender.sendMessage("§cThere are no players matching that name."); + } + else + { + final String senderName = sender instanceof Player ? ess.getUser(sender).getDisplayName() : Console.NAME; + sender.sendMessage("[" + senderName + ">" + address + "] " + message); + EssentialsXMPP.getInstance().sendMessage(address, "[" + senderName + "] " + message); + } + } +} |