catch NumberFormatException, fixed off-by-one error
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								dist/DiscoSheep.jar
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								dist/DiscoSheep.jar
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -74,7 +74,7 @@ public class DiscoParty { | ||||
| 	} | ||||
|  | ||||
| 	public DiscoParty setDuration(int duration) throws IllegalArgumentException { | ||||
| 		if (duration < DiscoParty.maxDuration) { | ||||
| 		if (duration <= DiscoParty.maxDuration) { | ||||
| 			this.duration = duration; | ||||
| 			return this; | ||||
| 		} else { | ||||
| @@ -92,7 +92,7 @@ public class DiscoParty { | ||||
| 	} | ||||
|  | ||||
| 	public DiscoParty setRadius(int radius) throws IllegalArgumentException { | ||||
| 		if (radius < DiscoParty.maxRadius) { | ||||
| 		if (radius <= DiscoParty.maxRadius) { | ||||
| 			this.radius = radius; | ||||
| 			return this; | ||||
| 		} else { | ||||
| @@ -101,7 +101,7 @@ public class DiscoParty { | ||||
| 	} | ||||
|  | ||||
| 	public DiscoParty setSheep(int sheep) throws IllegalArgumentException { | ||||
| 		if (sheep < DiscoParty.maxSheep) { | ||||
| 		if (sheep <= DiscoParty.maxSheep) { | ||||
| 			this.sheep = sheep; | ||||
| 			return this; | ||||
| 		} else { | ||||
|   | ||||
| @@ -15,7 +15,6 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { | ||||
| 	public DiscoSheepCommandExecutor(DiscoSheep parent) { | ||||
| 		this.parent = parent; | ||||
| 	} | ||||
| 	 | ||||
| 	private static final String PERMISSION_PARTY = "discosheep.party"; | ||||
| 	private static final String PERMISSION_ALL = "discosheep.partyall"; | ||||
| 	private static final String PERMISSION_FIREWORKS = "discosheep.fireworks"; | ||||
| @@ -42,7 +41,11 @@ public class DiscoSheepCommandExecutor implements CommandExecutor { | ||||
|  | ||||
| 	private int parseNextIntArg(String[] args, int i) { | ||||
| 		if (i < args.length - 1) { | ||||
| 			try { | ||||
| 				return Integer.parseInt(args[i + 1]); | ||||
| 			} catch (NumberFormatException e) { | ||||
| 				return -1; | ||||
| 			}  | ||||
| 		} | ||||
| 		return -1; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Gibstick
					Gibstick