Solved Why can't I execute plugin commands on the spigot side

  • After careful consideration and due to limited usage, we’ve made the decision to discontinue the PaperMC forums. Moving forward, we recommend using Hangar for plugin uploads, and for all other community discussions and support, please join us on Discord.

qscbm187531

New member
Jul 22, 2023
1
0
1
Solved
---------------------------------------
The plugin commands I wrote can only be used in the console, the player cannot execute them, and the commands of other plugins are all fine.
CommandMeta meta = server.getCommandManager().metaBuilder("mycommand").aliases("mycmd").plugin(this).build();
server.getCommandManager().register(meta,new MyCommand());
public class MyCommand implements SimpleCommand {
@Override
public void execute(Invocation invocation) {
String[] args = invocation.arguments();
if (args.length == 0 || args.length>3 || args.length == 2) {
sendHelp(invocation);
return;
}
// execute
}

@Override
public boolean hasPermission(Invocation invocation) {
return invocation.source().hasPermission("permission");
}
 
Last edited: