Adds a getBukkitSender API function to provide translation between vanilla's CommandWrapperListener and Bukkit's CommandSender.
The main targeted use case of this method is be ArgumentBuilder#requires. When the command tree is traversed by vanilla, the \<S> type is CommandWrapperListener, but plugins cannot do anything with that since they are not aware of that class. This method allows conversion of that object to a CommandSender so that normal Bukkit calls can be performed (such as checking for permissions or checking whether the executer isOp).
Tested with my own plugin, and seems to work like a charm. For example:
builder.requires((sender) -> commodore.getBukkitSender(sender).isOp());
will be a node only sent to players that are op.
Adds a getBukkitSender API function to provide translation between vanilla's CommandWrapperListener and Bukkit's CommandSender.
The main targeted use case of this method is be ArgumentBuilder#requires. When the command tree is traversed by vanilla, the \<S> type is CommandWrapperListener, but plugins cannot do anything with that since they are not aware of that class. This method allows conversion of that object to a CommandSender so that normal Bukkit calls can be performed (such as checking for permissions or checking whether the executer isOp).
Tested with my own plugin, and seems to work like a charm. For example:
builder.requires((sender) -> commodore.getBukkitSender(sender).isOp());
will be a node only sent to players that are op.