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 | 2d038579badae3bea197d1a7fa7801e8a74e6e97 (patch) | |
tree | d02679b01badc46357c4b69bf52bc08e1479bb1f /EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java | |
parent | ba86a338c2578044ee451138192de2b525260944 (diff) | |
download | Essentials-2d038579badae3bea197d1a7fa7801e8a74e6e97.tar Essentials-2d038579badae3bea197d1a7fa7801e8a74e6e97.tar.gz Essentials-2d038579badae3bea197d1a7fa7801e8a74e6e97.tar.lz Essentials-2d038579badae3bea197d1a7fa7801e8a74e6e97.tar.xz Essentials-2d038579badae3bea197d1a7fa7801e8a74e6e97.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/Commandxmppspy.java')
-rw-r--r-- | EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java new file mode 100644 index 000000000..c42049b22 --- /dev/null +++ b/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java @@ -0,0 +1,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(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception + { + 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()); + } + } + } +}
\ No newline at end of file |