dense radius, fix off-by-one in /ds other
This commit is contained in:
parent
4197397f50
commit
15dd55712a
@ -50,16 +50,15 @@ public class DiscoCommands {
|
|||||||
private static void parsePartyFlags(DiscoParty party, final CommandContext args, CommandSender sender) throws IllegalArgumentException {
|
private static void parsePartyFlags(DiscoParty party, final CommandContext args, CommandSender sender) throws IllegalArgumentException {
|
||||||
party.setDuration(args.getFlagInteger('t', DiscoParty.defaultDuration));
|
party.setDuration(args.getFlagInteger('t', DiscoParty.defaultDuration));
|
||||||
party.setPeriod(args.getFlagInteger('p', DiscoParty.defaultPeriod));
|
party.setPeriod(args.getFlagInteger('p', DiscoParty.defaultPeriod));
|
||||||
party.setRadius(args.getFlagInteger('r', DiscoParty.defaultRadius));
|
|
||||||
party.setSheep(args.getFlagInteger('n', DiscoParty.defaultSheep));
|
party.setSheep(args.getFlagInteger('n', DiscoParty.defaultSheep));
|
||||||
|
|
||||||
// handle the special case of radius flag arg "dense"
|
// 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)) {
|
if ("dense".equals(radiusArg)) {
|
||||||
party.setDenseRadius(party.getSheep());
|
party.setDenseRadius(party.getSheep());
|
||||||
} else {
|
} else {
|
||||||
party.setRadius(Integer.parseInt(radiusArg));
|
party.setRadius(Integer.parseInt(radiusArg));
|
||||||
}*/
|
}
|
||||||
|
|
||||||
if (sender.hasPermission(PERMISSION_FIREWORKS)) {
|
if (sender.hasPermission(PERMISSION_FIREWORKS)) {
|
||||||
party.setDoFireworks(args.hasFlag('f'));
|
party.setDoFireworks(args.hasFlag('f'));
|
||||||
@ -135,7 +134,7 @@ public class DiscoCommands {
|
|||||||
public static void partyOtherCommand(CommandContext args, CommandSender sender) {
|
public static void partyOtherCommand(CommandContext args, CommandSender sender) {
|
||||||
DiscoParty party = new DiscoParty();
|
DiscoParty party = new DiscoParty();
|
||||||
Player p;
|
Player p;
|
||||||
String players[] = args.getSlice(0);
|
String players[] = args.getSlice(1);
|
||||||
|
|
||||||
parsePartyFlags(party, args, sender);
|
parsePartyFlags(party, args, sender);
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ public final class DiscoSheep extends JavaPlugin {
|
|||||||
} catch (WrappedCommandException e) {
|
} catch (WrappedCommandException e) {
|
||||||
if (e.getCause() instanceof NumberFormatException) {
|
if (e.getCause() instanceof NumberFormatException) {
|
||||||
sender.sendMessage(ChatColor.RED + "Number expected, string received instead.");
|
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 {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + "An error has occurred. See console.");
|
sender.sendMessage(ChatColor.RED + "An error has occurred. See console.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -69,7 +71,6 @@ public final class DiscoSheep extends JavaPlugin {
|
|||||||
} catch (com.sk89q.minecraft.util.commands.CommandException ex) {
|
} catch (com.sk89q.minecraft.util.commands.CommandException ex) {
|
||||||
Logger.getLogger(DiscoSheep.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(DiscoSheep.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user