You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When hasPermission() == false, SimpleCommand classes will only forward the command if no arguments are used. Adding any argument will make the proxy catch it, throwing an error.
Simple PoC:
importcom.velocitypowered.api.command.SimpleCommand;
importnet.kyori.adventure.text.Component;
importnet.kyori.adventure.text.format.NamedTextColor;
publicclassTestCommandimplementsSimpleCommand {
@Overridepublicvoidexecute(Invocationinvocation) {
invocation.source().sendMessage(Component.text("Invoked!", NamedTextColor.GREEN));
}
@OverridepublicbooleanhasPermission(Invocationinvocation) {
// With this, the command should be forwarded to the backend server in any case.returnfalse;
}
}
// ...commandManager.register("test", newTestCommand()); // same effect with CommandMeta
Expected result /test -> Forwarded to backend /test abc -> Forwarded to backend
Actual result /test -> Forwarded to backend /test abc -> Incorrect argument for command at position 5: test <--[HERE] (in red, Brigadier error)
When hasPermission is changed to return true, the command works as expected for hasPermission() == true. (printing Invoked! with and without args)
The text was updated successfully, but these errors were encountered:
roccodev
changed the title
SimpleCommand failing to forward commands with args
SimpleCommand fails to forward commands with args
Aug 4, 2021
Might be related to #369.
When
hasPermission() == false
,SimpleCommand
classes will only forward the command if no arguments are used. Adding any argument will make the proxy catch it, throwing an error.Simple PoC:
Expected result
/test
-> Forwarded to backend/test abc
-> Forwarded to backendActual result
/test
-> Forwarded to backend/test abc
->Incorrect argument for command at position 5: test <--[HERE]
(in red, Brigadier error)When
hasPermission
is changed to returntrue
, the command works as expected forhasPermission() == true
. (printingInvoked!
with and without args)The text was updated successfully, but these errors were encountered: