dense radius, fix off-by-one in /ds other

This commit is contained in:
Charlie 2014-07-29 18:14:18 -04:00
parent 4197397f50
commit 15dd55712a
2 changed files with 7 additions and 7 deletions

View File

@ -50,16 +50,15 @@ public class DiscoCommands {
private static void parsePartyFlags(DiscoParty party, final CommandContext args, CommandSender sender) throws IllegalArgumentException {
party.setDuration(args.getFlagInteger('t', DiscoParty.defaultDuration));
party.setPeriod(args.getFlagInteger('p', DiscoParty.defaultPeriod));
party.setRadius(args.getFlagInteger('r', DiscoParty.defaultRadius));
party.setSheep(args.getFlagInteger('n', DiscoParty.defaultSheep));
// handle the special case of radius flag arg "dense"
/*String radiusArg = args.getFlag('r');
String radiusArg = args.getFlag('r', Integer.toString(DiscoParty.defaultRadius));
if ("dense".equals(radiusArg)) {
party.setDenseRadius(party.getSheep());
} else {
party.setRadius(Integer.parseInt(radiusArg));
}*/
}
if (sender.hasPermission(PERMISSION_FIREWORKS)) {
party.setDoFireworks(args.hasFlag('f'));
@ -135,7 +134,7 @@ public class DiscoCommands {
public static void partyOtherCommand(CommandContext args, CommandSender sender) {
DiscoParty party = new DiscoParty();
Player p;
String players[] = args.getSlice(0);
String players[] = args.getSlice(1);
parsePartyFlags(party, args, sender);

View File

@ -60,6 +60,8 @@ public final class DiscoSheep extends JavaPlugin {
} catch (WrappedCommandException e) {
if (e.getCause() instanceof NumberFormatException) {
sender.sendMessage(ChatColor.RED + "Number expected, string received instead.");
} else if (e.getCause() instanceof IllegalArgumentException) {
sender.sendMessage(ChatColor.RED + "Illegal argument (out of bounds or bad format).");
} else {
sender.sendMessage(ChatColor.RED + "An error has occurred. See console.");
e.printStackTrace();
@ -69,7 +71,6 @@ public final class DiscoSheep extends JavaPlugin {
} catch (com.sk89q.minecraft.util.commands.CommandException ex) {
Logger.getLogger(DiscoSheep.class.getName()).log(Level.SEVERE, null, ex);
}
return true;
}