Error handling for user entering non-integer value for radius of safeclaim and warclaim, along with usage info
This commit is contained in:
1 parent
3bcfd5cff5
commit
a38267fe74
2 files changed
+18
-2
No files matched your search
@@ -36,7 +36,15 @@ public class FCommandSafeclaim extends FBaseCommand {
|
||||
|
||||
// Was a radius set?
|
||||
if (parameters.size() > 0) {
|
||||
int radius = Integer.parseInt(parameters.get(0));
|
||||
int radius;
|
||||
try {
|
||||
radius = Integer.parseInt(parameters.get(0));
|
||||
}
|
||||
catch(NumberFormatException ex) {
|
||||
sendMessage("Usage: " + getUseageTemplate(false));
|
||||
sendMessage("The radius value must be an integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
FLocation from = playerFlocation.getRelative(radius, radius);
|
||||
FLocation to = playerFlocation.getRelative(-radius, -radius);
|
||||
|
||||
@@ -35,7 +35,15 @@ public class FCommandWarclaim extends FBaseCommand {
|
||||
|
||||
// Was a radius set?
|
||||
if (parameters.size() > 0) {
|
||||
int radius = Integer.parseInt(parameters.get(0));
|
||||
int radius;
|
||||
try {
|
||||
radius = Integer.parseInt(parameters.get(0));
|
||||
}
|
||||
catch(NumberFormatException ex) {
|
||||
sendMessage("Usage: " + getUseageTemplate(false));
|
||||
sendMessage("The radius value must be an integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
FLocation from = playerFlocation.getRelative(radius, radius);
|
||||
FLocation to = playerFlocation.getRelative(-radius, -radius);
|
||||
|
||||
Reference in new issue
Block a user