Made getArgument return the actual value, not a container object

This commit is contained in:
Nathan Adams
2017-06-28 10:55:56 +02:00
parent 8e3b29d22e
commit bafe8e6b56
3 changed files with 6 additions and 6 deletions
@@ -38,7 +38,7 @@ public class IntegerArgumentType implements CommandArgumentType<Integer> {
}
public static int getInteger(CommandContext<?> context, String name) {
return context.getArgument(name, int.class).getResult();
return context.getArgument(name, int.class);
}
@Override
@@ -34,7 +34,7 @@ public class CommandContext<S> {
}
@SuppressWarnings("unchecked")
public <V> ParsedArgument<V> getArgument(String name, Class<V> clazz) {
public <V> V getArgument(String name, Class<V> clazz) {
ParsedArgument<?> argument = arguments.get(name);
if (argument == null) {
@@ -42,7 +42,7 @@ public class CommandContext<S> {
}
if (Primitives.wrap(clazz).isAssignableFrom(argument.getResult().getClass())) {
return (ParsedArgument<V>) argument;
return ((ParsedArgument<V>) argument).getResult();
} else {
throw new IllegalArgumentException("Argument '" + name + "' is defined as " + argument.getResult().getClass().getSimpleName() + ", not " + clazz);
}