/ds all and /ds stop commands implemented

This commit is contained in:
Charlie Wang 2013-06-30 23:16:18 -04:00
parent 5419d97426
commit e4a7eed814

View File

@ -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;
}