Question How to get the plugin a command is executed by?

  • 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.

iJustLeyxo

New member
Apr 26, 2022
3
0
1
I am coding a permission plugin and need to get the plugin instance from which a command is managed (and has the executor registered). Would be very glad about any help or suggestions how to approach the problem differently!
 

Tacklezaza

New member
Aug 14, 2022
15
0
1
So, you want to check who execute the command and you too lazy to check instanceof? Like...

Java:
boolean hasPermission = false;
if(sender instanceOf Player){
    Player player = (Player)sender;
    if(player.isOp()){
        hasPermission = true;
    }
}
else if(sender instanceOf ConsoleCommandExecutor){
    hasPermission = true;
}

Or what?