From e4a7eed81428d99856a8a6b0485393e6978d6fb5 Mon Sep 17 00:00:00 2001 From: Charlie Wang Date: Sun, 30 Jun 2013 23:16:18 -0400 Subject: [PATCH] /ds all and /ds stop commands implemented --- .../discosheep/DiscoSheepCommandExecutor.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java b/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java index d56a8b1..fca8241 100644 --- a/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java +++ b/src/gibstick/bukkit/discosheep/DiscoSheepCommandExecutor.java @@ -1,5 +1,6 @@ package gibstick.bukkit.discosheep; +import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.CommandExecutor; @@ -15,8 +16,22 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { - if (sender instanceof Player) { - parent.startParty((Player)sender); + if (args.length == 1) { + if ("all".equals(args[0])) { + for (Player player : Bukkit.getServer().getOnlinePlayers()) { + parent.startParty(player); + } + } + else if ("stop".equals(args[0])) { + parent.stopAllParties(); + } else { + sender.sendMessage("Invalid argument."); + return true; + } + } else { + if (sender instanceof Player) { + parent.startParty((Player) sender); + } } return true; }