implemented -g none to spawn a party without extra guests

This commit is contained in:
Gibstick 2013-07-26 21:29:06 -04:00
parent 20691b0904
commit 23e4a3887f
2 changed files with 20 additions and 10 deletions

View File

@ -106,7 +106,7 @@ public final class DiscoSheep extends JavaPlugin {
for (Map.Entry<String, Integer> entry : DiscoParty.getDefaultGuestNumbers().entrySet()) { for (Map.Entry<String, Integer> entry : DiscoParty.getDefaultGuestNumbers().entrySet()) {
getConfig().set("default.guests." + entry.getKey(), entry.getValue()); getConfig().set("default.guests." + entry.getKey(), entry.getValue());
} }
saveConfig(); saveConfig();
} }
@ -163,17 +163,17 @@ public final class DiscoSheep extends JavaPlugin {
/*-- Actual commands begin here --*/ /*-- Actual commands begin here --*/
boolean helpCommand(CommandSender sender) { boolean helpCommand(CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW sender.sendMessage(ChatColor.YELLOW
+ "DiscoSheep Help\n" + "DiscoSheep Help\n"
+ ChatColor.GRAY + ChatColor.GRAY
+ " Subcommands\n" + " Subcommands\n"
+ ChatColor.WHITE + "me, stop, all, stopall, save, reload\n" + ChatColor.WHITE + "me, stop, all, stopall, save, reload\n"
+ "other <players>: start a party for the space-delimited list of players\n" + "other <players>: start a party for the space-delimited list of players\n"
+ "defaults: Change the default settings for parties (takes normal arguments)\n" + "defaults: Change the default settings for parties (takes normal arguments)\n"
+ ChatColor.GRAY + " Arguments\n" + ChatColor.GRAY + " Arguments\n"
+ ChatColor.WHITE + "-n <integer>: set the number of sheep per player that spawn\n" + ChatColor.WHITE + "-n <integer>: set the number of sheep per player that spawn\n"
+ "-t <integer>: set the party duration in seconds\n" + "-t <integer>: set the party duration in seconds\n"
+ "-p <ticks>: set the number of ticks between each disco beat\n" + "-p <ticks>: set the number of ticks between each disco beat\n"
+ "-r <integer>: set radius of the area in which sheep can spawn\n" + "-r <integer>: set radius of the area in which sheep can spawn\n"
+ "-g <mob> <number>: set spawns for other mobs" + "-g <mob> <number>: set spawns for other mobs"
+ "-fw: enables fireworks"); + "-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) { boolean noPermsMessage(CommandSender sender, String permission) {
sender.sendMessage(ChatColor.RED + "You do not have the permission node " + ChatColor.GRAY + permission); sender.sendMessage(ChatColor.RED + "You do not have the permission node " + ChatColor.GRAY + permission);
return false; return false;

View File

@ -149,6 +149,11 @@ public class DiscoSheepCommandExecutor implements CommandExecutor {
if (!sender.hasPermission(DiscoSheep.PERMISSION_SPAWNGUESTS)) { if (!sender.hasPermission(DiscoSheep.PERMISSION_SPAWNGUESTS)) {
return parent.noPermsMessage(sender, 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); String[] guests = getNextArgs(args, i + 1);
int j = 0; int j = 0;
while (j < guests.length) { while (j < guests.length) {