diff options
author | Zenexer <Zenexer@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-03-30 04:03:21 +0000 |
---|---|---|
committer | Zenexer <Zenexer@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-03-30 04:03:21 +0000 |
commit | cb21bc4d7a67f0974c2773fdd0f5376f177c068e (patch) | |
tree | f1584fe391f77c648a1d7d25385ef16229b756de /Essentials/src/com/earth2me/essentials/commands/Commandkickall.java | |
download | Essentials-cb21bc4d7a67f0974c2773fdd0f5376f177c068e.tar Essentials-cb21bc4d7a67f0974c2773fdd0f5376f177c068e.tar.gz Essentials-cb21bc4d7a67f0974c2773fdd0f5376f177c068e.tar.lz Essentials-cb21bc4d7a67f0974c2773fdd0f5376f177c068e.tar.xz Essentials-cb21bc4d7a67f0974c2773fdd0f5376f177c068e.zip |
2.1 prerelease, part 2 of 3
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk2.1@1015 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandkickall.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandkickall.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java new file mode 100644 index 000000000..e73f57a00 --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java @@ -0,0 +1,55 @@ +package com.earth2me.essentials.commands; + +import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import com.earth2me.essentials.Essentials; +import com.earth2me.essentials.User; + +public class Commandkickall extends EssentialsCommand +{ + public Commandkickall() + { + super("kickall"); + } + + @Override + public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception + { + if (args.length < 1) + { + user.sendMessage("§7Usage: /" + commandLabel + "<reason>"); + return; + } + + + for (Player p : server.getOnlinePlayers()) + { + if (server.getOnlinePlayers().length == 1 && p.getName().equalsIgnoreCase(user.getName())) + { + user.sendMessage("§7Only you online..."); + return; + } + else + { + if (!p.getName().equalsIgnoreCase(user.getName())) + { + p.kickPlayer(args.length < 1 ? args[0] : "Kicked from server"); + } + } + } + } + + @Override + public void run(Server server, Essentials parent, CommandSender sender, String commandLabel, String[] args) throws Exception + { + if (args.length < 1) + { + sender.sendMessage("Usage: /" + commandLabel + "<reason>"); + return; + } + + for (Player p : server.getOnlinePlayers()) + p.kickPlayer(args.length < 1 ? args[0] : "Kicked from server"); + } +} |