Skip to content

Commit

Permalink
call setRawCommand so the execution logic is delegated to us
Browse files Browse the repository at this point in the history
  • Loading branch information
Revxrsal committed Sep 26, 2023
1 parent 389fa8e commit c54fcfb
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private void registerListener(Plugin plugin) {
LiteralCommandNode<?> node = commands.get(commandLabel);
if (node != null) {
ref.setLiteral.call(event, node);
ref.setRawCommand.call(event, true);
}
}, plugin);
}
Expand Down Expand Up @@ -139,11 +140,13 @@ static void ensureSetup() {
Method getCommand = eventClass.getDeclaredMethod("getCommand");
Method getCommandLabel = eventClass.getDeclaredMethod("getCommandLabel");
Method setLiteral = eventClass.getDeclaredMethod("setLiteral", LiteralCommandNode.class);
Method setRawCommand = eventClass.getDeclaredMethod("setRawCommand", boolean.class);
return new RegisterEventReflection(
eventClass,
defaultFactory().createFor(getCommand),
defaultFactory().createFor(getCommandLabel),
defaultFactory().createFor(setLiteral)
defaultFactory().createFor(setLiteral),
defaultFactory().createFor(setRawCommand)
);
} catch (Throwable e) {
throw new UnsupportedOperationException("Not running on modern Paper!", e);
Expand All @@ -154,7 +157,7 @@ static void ensureSetup() {
private static final class RegisterEventReflection {

private final Class<? extends Event> eventClass;
private final MethodCaller getCommand, getCommandLabel, setLiteral;
private final MethodCaller getCommand, getCommandLabel, setLiteral, setRawCommand;
}


Expand Down

0 comments on commit c54fcfb

Please sign in to comment.