mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-16 22:03:53 +00:00
Cleanup and a few bugfixes
This commit is contained in:
@ -133,8 +133,9 @@ public class CommandContext {
|
||||
throw new CommandException("Value flag '" + flagName + "' already given");
|
||||
}
|
||||
|
||||
if (nextArg >= argList.size())
|
||||
if (nextArg >= argList.size()) {
|
||||
throw new CommandException("No value specified for the '-"+flagName+"' flag.");
|
||||
}
|
||||
|
||||
// If it is a value flag, read another argument and add it
|
||||
this.valueFlags.put(flagName, argList.get(nextArg++));
|
||||
@ -217,8 +218,9 @@ public class CommandContext {
|
||||
|
||||
public String getFlag(char ch, String def) {
|
||||
final String value = valueFlags.get(ch);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
return def;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -229,8 +231,9 @@ public class CommandContext {
|
||||
|
||||
public int getFlagInteger(char ch, int def) throws NumberFormatException {
|
||||
final String value = valueFlags.get(ch);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
return def;
|
||||
}
|
||||
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
@ -241,8 +244,9 @@ public class CommandContext {
|
||||
|
||||
public double getFlagDouble(char ch, double def) throws NumberFormatException {
|
||||
final String value = valueFlags.get(ch);
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
return def;
|
||||
}
|
||||
|
||||
return Double.parseDouble(value);
|
||||
}
|
||||
|
@ -422,7 +422,8 @@ public abstract class CommandsManager<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public void invokeMethod(Method parent, String[] args, T player, Method method, Object instance, Object[] methodArgs, int level) throws CommandException {
|
||||
public void invokeMethod(Method parent, String[] args, T player, Method method,
|
||||
Object instance, Object[] methodArgs, int level) throws CommandException {
|
||||
try {
|
||||
method.invoke(instance, methodArgs);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
Reference in New Issue
Block a user