mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Handle exceptions thrown from bindings as a convertible InvocationTargetException.
For example, if IncompleteRegionException is thrown by a binding, it will result in a InvocationTargetException now with a getCause(), which gets handled as if that exception was thrown from the actual Method that is invoked for the command.
This commit is contained in:
parent
11d37bce2b
commit
08ad5f4451
@ -23,6 +23,7 @@ import com.sk89q.minecraft.util.commands.CommandException;
|
|||||||
import com.sk89q.worldedit.util.command.binding.PrimitiveBindings;
|
import com.sk89q.worldedit.util.command.binding.PrimitiveBindings;
|
||||||
import com.sk89q.worldedit.util.command.binding.StandardBindings;
|
import com.sk89q.worldedit.util.command.binding.StandardBindings;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ public interface Binding {
|
|||||||
* @throws CommandException on a command exception
|
* @throws CommandException on a command exception
|
||||||
*/
|
*/
|
||||||
Object bind(ParameterData parameter, ArgumentStack scoped, boolean onlyConsume)
|
Object bind(ParameterData parameter, ArgumentStack scoped, boolean onlyConsume)
|
||||||
throws ParameterException, CommandException;
|
throws ParameterException, CommandException, InvocationTargetException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of suggestions for the given parameter and user arguments.
|
* Get a list of suggestions for the given parameter and user arguments.
|
||||||
|
@ -143,7 +143,7 @@ public class BindingHelper implements Binding {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object bind(ParameterData parameter, ArgumentStack scoped,
|
public Object bind(ParameterData parameter, ArgumentStack scoped,
|
||||||
boolean onlyConsume) throws ParameterException, CommandException {
|
boolean onlyConsume) throws ParameterException, CommandException, InvocationTargetException {
|
||||||
BoundMethod binding = match(parameter);
|
BoundMethod binding = match(parameter);
|
||||||
List<Object> args = new ArrayList<Object>();
|
List<Object> args = new ArrayList<Object>();
|
||||||
args.add(scoped);
|
args.add(scoped);
|
||||||
@ -178,7 +178,7 @@ public class BindingHelper implements Binding {
|
|||||||
} else if (e.getCause() instanceof CommandException) {
|
} else if (e.getCause() instanceof CommandException) {
|
||||||
throw (CommandException) e.getCause();
|
throw (CommandException) e.getCause();
|
||||||
}
|
}
|
||||||
throw new RuntimeException(e.getCause());
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ class ParametricCallable implements CommandCallable {
|
|||||||
* @throws CommandException on an error
|
* @throws CommandException on an error
|
||||||
*/
|
*/
|
||||||
private Object getDefaultValue(int i, ContextArgumentStack scoped)
|
private Object getDefaultValue(int i, ContextArgumentStack scoped)
|
||||||
throws ParameterException, CommandException {
|
throws ParameterException, CommandException, InvocationTargetException {
|
||||||
CommandContext context = scoped.getContext();
|
CommandContext context = scoped.getContext();
|
||||||
ParameterData parameter = parameters[i];
|
ParameterData parameter = parameters[i];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user