-
Notifications
You must be signed in to change notification settings - Fork 0
Creating subcommand fail listener
Leonardo Luiz Gava edited this page Jan 6, 2023
·
6 revisions
You can create events to be triggered when a subcommand is not executed correctly, for example if the player dont have the permission to use a specific subcommand.
listener class
public class MyCustomListener implements Listener {
@EventHandler
public void playerWithoutPermission(SubcommandFailEvent event) {
if(event.getFailType() != NeelixSubcommandFailType.WITHOUT_PERMISSION_FOR_SUBCOMMAND) return;
Player player = event.getPlayerWithoutPermission();
NeelixSubcommand subcommand = event.getSubcommand();
player.sendMessage("You don't have permission to use the subcommand " + subcommand.getName());
player.sendMessage("Needed permission: " + subcommand.getPermission());
}
}listener class
public class MyCustomListener implements Listener {
@EventHandler
public void subcommandNotFound(SubcommandFailEvent event) {
if(event.getFailType() != NeelixSubcommandFailType.SUBCOMMAND_NOT_FOUND) return;
Player player = event.getPlayerWithoutPermission();
player.sendMessage("Subcommand not found. Use /help command for more info.");
}
}
Creating your first custom configuration file
Creating your first subcommand
- Introduction
- Creating subcommand class
- Registering subcommands on parent command
- Registering parent command
- Using subcommand as CommandExecutor
Creating subcommand fail listener
Creating Custom Inventories WIP 🚧
- Introduction
- Creating your first Simple Inventory
- Creating your first Paginated Inventory
- What is the locked slots parameter?
- Creating Inventory Items
- Creating Custom Navigation
- Registering your inventories