From 23e4a3887f916e25e961cde82de5dec1b05c5308 Mon Sep 17 00:00:00 2001 From: Gibstick Date: Fri, 26 Jul 2013 21:29:06 -0400 Subject: [PATCH] implemented -g none to spawn a party without extra guests --- src/ca/gibstick/discosheep/DiscoSheep.java | 25 +++++++++++-------- .../discosheep/DiscoSheepCommandExecutor.java | 5 ++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/ca/gibstick/discosheep/DiscoSheep.java b/src/ca/gibstick/discosheep/DiscoSheep.java index b790bbc..71cb9d3 100644 --- a/src/ca/gibstick/discosheep/DiscoSheep.java +++ b/src/ca/gibstick/discosheep/DiscoSheep.java @@ -106,7 +106,7 @@ public final class DiscoSheep extends JavaPlugin { for (Map.Entry entry : DiscoParty.getDefaultGuestNumbers().entrySet()) { getConfig().set("default.guests." + entry.getKey(), entry.getValue()); } - + saveConfig(); } @@ -163,17 +163,17 @@ public final class DiscoSheep extends JavaPlugin { /*-- Actual commands begin here --*/ boolean helpCommand(CommandSender sender) { - sender.sendMessage(ChatColor.YELLOW - + "DiscoSheep Help\n" - + ChatColor.GRAY - + " Subcommands\n" - + ChatColor.WHITE + "me, stop, all, stopall, save, reload\n" + sender.sendMessage(ChatColor.YELLOW + + "DiscoSheep Help\n" + + ChatColor.GRAY + + " Subcommands\n" + + ChatColor.WHITE + "me, stop, all, stopall, save, reload\n" + "other : start a party for the space-delimited list of players\n" + "defaults: Change the default settings for parties (takes normal arguments)\n" - + ChatColor.GRAY + " Arguments\n" - + ChatColor.WHITE + "-n : set the number of sheep per player that spawn\n" - + "-t : set the party duration in seconds\n" - + "-p : set the number of ticks between each disco beat\n" + + ChatColor.GRAY + " Arguments\n" + + ChatColor.WHITE + "-n : set the number of sheep per player that spawn\n" + + "-t : set the party duration in seconds\n" + + "-p : set the number of ticks between each disco beat\n" + "-r : set radius of the area in which sheep can spawn\n" + "-g : set spawns for other mobs" + "-fw: enables fireworks"); @@ -281,6 +281,11 @@ public final class DiscoSheep extends JavaPlugin { } + boolean zeroGuests(DiscoParty party) { + party.getGuestNumbers().clear(); + return true; + } + boolean noPermsMessage(CommandSender sender, String permission) { sender.sendMessage(ChatColor.RED + "You do not have the permission node " + ChatColor.GRAY + permission); return false; diff --git a/src/ca/gibstick/discosheep/DiscoSheepCommandExecutor.java b/src/ca/gibstick/discosheep/DiscoSheepCommandExecutor.java index e2bd626..18efafc 100644 --- a/src/ca/gibstick/discosheep/DiscoSheepCommandExecutor.java +++ b/src/ca/gibstick/discosheep/DiscoSheepCommandExecutor.java @@ -149,6 +149,11 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { if (!sender.hasPermission(DiscoSheep.PERMISSION_SPAWNGUESTS)) { return parent.noPermsMessage(sender, DiscoSheep.PERMISSION_SPAWNGUESTS); } + + if (parseNextArg(args, i, "none")) { + return parent.zeroGuests(mainParty); + } + String[] guests = getNextArgs(args, i + 1); int j = 0; while (j < guests.length) {