mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-30 21:17:53 +01:00
Catch Throwable instead of Exception
This commit is contained in:
parent
1b55bd0137
commit
f1c9268897
@ -44,8 +44,7 @@ public class ParsedCommand {
|
||||
final CommandCondition condition = command.getCondition();
|
||||
if (condition != null) {
|
||||
final boolean result = condition.canUse(source, commandString);
|
||||
if (!result)
|
||||
return null;
|
||||
if (!result) return null;
|
||||
}
|
||||
// Condition is respected
|
||||
if (executor != null) {
|
||||
@ -58,16 +57,16 @@ public class ParsedCommand {
|
||||
context.retrieveDefaultValues(syntax.getDefaultValuesMap());
|
||||
try {
|
||||
executor.apply(source, context);
|
||||
} catch (Exception exception) {
|
||||
MinecraftServer.getExceptionManager().handleException(exception);
|
||||
} catch (Throwable throwable) {
|
||||
MinecraftServer.getExceptionManager().handleException(throwable);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// The executor is probably the default one
|
||||
try {
|
||||
executor.apply(source, context);
|
||||
} catch (Exception exception) {
|
||||
MinecraftServer.getExceptionManager().handleException(exception);
|
||||
} catch (Throwable throwable) {
|
||||
MinecraftServer.getExceptionManager().handleException(throwable);
|
||||
}
|
||||
}
|
||||
} else if (callback != null && argumentSyntaxException != null) {
|
||||
|
@ -397,7 +397,12 @@ class EventNodeImpl<T extends Event> implements EventNode<T> {
|
||||
this.listeners.add(e -> {
|
||||
if (hasPredicate) {
|
||||
final Object value = filter.getHandler(e);
|
||||
if (!predicate.test(e, value)) return;
|
||||
try {
|
||||
if (!predicate.test(e, value)) return;
|
||||
} catch (Throwable t) {
|
||||
MinecraftServer.getExceptionManager().handleException(t);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!listenersCopy.isEmpty()) {
|
||||
for (EventListener<E> listener : listenersCopy) {
|
||||
@ -406,7 +411,11 @@ class EventNodeImpl<T extends Event> implements EventNode<T> {
|
||||
}
|
||||
if (!bindingsCopy.isEmpty()) {
|
||||
for (Consumer<E> eConsumer : bindingsCopy) {
|
||||
eConsumer.accept(e);
|
||||
try {
|
||||
eConsumer.accept(e);
|
||||
} catch (Throwable t) {
|
||||
MinecraftServer.getExceptionManager().handleException(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -416,9 +425,9 @@ class EventNodeImpl<T extends Event> implements EventNode<T> {
|
||||
EventListener.Result result;
|
||||
try {
|
||||
result = listener.run(event);
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable t) {
|
||||
result = EventListener.Result.EXCEPTION;
|
||||
MinecraftServer.getExceptionManager().handleException(e);
|
||||
MinecraftServer.getExceptionManager().handleException(t);
|
||||
}
|
||||
if (result == EventListener.Result.EXPIRED) {
|
||||
targetNode.removeListener(listener);
|
||||
|
Loading…
Reference in New Issue
Block a user