exceptions, y u no work
This commit is contained in:
parent
cca4cb11e3
commit
0830764cc3
BIN
dist/DiscoSheep.jar
vendored
BIN
dist/DiscoSheep.jar
vendored
Binary file not shown.
@ -59,6 +59,10 @@ public class DiscoParty {
|
|||||||
this.ds = parent;
|
this.ds = parent;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DiscoParty(DiscoSheep parent) {
|
||||||
|
this.ds = parent;
|
||||||
|
}
|
||||||
|
|
||||||
// copy but with new player
|
// copy but with new player
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +45,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor {
|
|||||||
return Integer.parseInt(args[i + 1]);
|
return Integer.parseInt(args[i + 1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class DiscoSheepCommandExecutor implements CommandExecutor {
|
|||||||
player = (Player) sender;
|
player = (Player) sender;
|
||||||
isPlayer = true;
|
isPlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for commands that don't need a party
|
// check for commands that don't need a party
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (args[0].equalsIgnoreCase("stopall")) {
|
if (args[0].equalsIgnoreCase("stopall")) {
|
||||||
@ -172,58 +172,56 @@ public class DiscoSheepCommandExecutor implements CommandExecutor {
|
|||||||
return helpCommand(sender);
|
return helpCommand(sender);
|
||||||
} else if (args[0].equalsIgnoreCase("reload")) {
|
} else if (args[0].equalsIgnoreCase("reload")) {
|
||||||
return reloadCommand(sender);
|
return reloadCommand(sender);
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Invalid argument (certain commands do not work from console).");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DiscoParty mainParty = new DiscoParty(parent);
|
||||||
|
|
||||||
for (int i = 1; i < args.length; i++) {
|
for (int i = 1; i < args.length; i++) {
|
||||||
if (args[i].equalsIgnoreCase("-fw")) {
|
if (args[i].equalsIgnoreCase("-fw")) {
|
||||||
if (senderHasPerm(sender, PERMISSION_FIREWORKS)) {
|
if (senderHasPerm(sender, PERMISSION_FIREWORKS)) {
|
||||||
fireworks = !fireworks;
|
mainParty.setDoFireworks(true);
|
||||||
} else {
|
} else {
|
||||||
noPermsMessage(sender, PERMISSION_FIREWORKS);
|
noPermsMessage(sender, PERMISSION_FIREWORKS);
|
||||||
}
|
}
|
||||||
} else if (args[i].equalsIgnoreCase("-r")) {
|
} else if (args[i].equalsIgnoreCase("-r")) {
|
||||||
radius = parseNextIntArg(args, i);
|
try {
|
||||||
|
mainParty.setRadius(parseNextIntArg(args, i));
|
||||||
if (radius < 1 || radius > DiscoParty.maxRadius) {
|
} catch (IllegalArgumentException e) {
|
||||||
sender.sendMessage("Radius must be an integer within the range [1, "
|
sender.sendMessage("Radius must be an integer within the range [1, "
|
||||||
+ DiscoParty.maxRadius + "]");
|
+ DiscoParty.maxRadius + "]");
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (args[i].equalsIgnoreCase("-n")) {
|
} else if (args[i].equalsIgnoreCase("-n")) {
|
||||||
sheepNumber = parseNextIntArg(args, i);
|
try {
|
||||||
|
mainParty.setSheep(parseNextIntArg(args, i));
|
||||||
if (sheepNumber < 1 || sheepNumber > DiscoParty.maxSheep) {
|
} catch (IllegalArgumentException e) {
|
||||||
sender.sendMessage("The number of sheep must be an integer within the range [1, "
|
sender.sendMessage("The number of sheep must be an integer within the range [1, "
|
||||||
+ DiscoParty.maxSheep + "]");
|
+ DiscoParty.maxSheep + "]");
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (args[i].equalsIgnoreCase("-t")) {
|
} else if (args[i].equalsIgnoreCase("-t")) {
|
||||||
duration = parent.toTicks(parseNextIntArg(args, i));
|
try {
|
||||||
|
mainParty.setDuration(parent.toTicks(parseNextIntArg(args, i)));
|
||||||
if (duration < 1 || duration > DiscoParty.maxDuration) {
|
} catch (IllegalArgumentException e) {
|
||||||
sender.sendMessage("The duration in seconds must be an integer within the range [1, "
|
sender.sendMessage("The duration in seconds must be an integer within the range [1, "
|
||||||
+ parent.toSeconds(DiscoParty.maxDuration) + "]");
|
+ parent.toSeconds(DiscoParty.maxDuration) + "]");
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (args[i].equalsIgnoreCase("-p")) {
|
} else if (args[i].equalsIgnoreCase("-p")) {
|
||||||
period = parseNextIntArg(args, i);
|
try {
|
||||||
|
mainParty.setPeriod(parseNextIntArg(args, i));
|
||||||
if (period < DiscoParty.minPeriod || period > DiscoParty.maxPeriod) {
|
} catch (IllegalArgumentException e) {
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
"The period in ticks must be within the range ["
|
"The period in ticks must be within the range ["
|
||||||
+ DiscoParty.minPeriod + ", "
|
+ DiscoParty.minPeriod + ", "
|
||||||
+ DiscoParty.maxPeriod + "]");
|
+ DiscoParty.maxPeriod + "]");
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("all")) {
|
if (args[0].equalsIgnoreCase("all")) {
|
||||||
return partyAllCommand(sender, duration, sheepNumber, radius, period, fireworks);
|
return partyAllCommand(sender, duration, sheepNumber, radius, period, fireworks);
|
||||||
} else if (args[0].equalsIgnoreCase("me") && isPlayer) {
|
} else if (args[0].equalsIgnoreCase("me") && isPlayer) {
|
||||||
@ -234,7 +232,6 @@ public class DiscoSheepCommandExecutor implements CommandExecutor {
|
|||||||
sender.sendMessage(ChatColor.RED + "Invalid argument (certain commands do not work from console).");
|
sender.sendMessage(ChatColor.RED + "Invalid argument (certain commands do not work from console).");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user