Solved How to override commands?

Discussion in 'Plugin Development' started by Dysko, Aug 7, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Dysko

    Hello. I am currently trying to make a plugin that stops the use of /pl, /plugins, /bukkit:, and /?. I have tested some code, but it has not worked yet. Currently, I am using this bit of code:
    Code:java
    1. @EventHandler
    2. public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent event) {
    3. Player p = event.getPlayer();
    4. if(event.getMessage().equalsIgnoreCase("/plugins")) {
    5. event.setCancelled(true);
    6. p.sendMessage("§cYou do not have permission to do that!");
    7. }
    8. }

    It still sends the message with all the plugins, when I want to cancel that and send the message that I put in. Any help?
     
  2. Offline

    MCForger

    Dysko
    1. Make sure the event listener is registered
    2. You could always negate the default bukkit permission node for the group of players you are concerned about
     
  3. Offline

    Dysko

    I'm also trying to stop the /bukkit: backend commands aswell. I am still unsure as to how to do it or what my mistake here is.

    And what do you mean by registering the event listener?
     
  4. Offline

    MCForger

  5. Offline

    Dysko


    Thank you. Also, is there a way to do this in it's own class folder that is not extending the JavaPlugin?
     
  6. Offline

    MCForger

    Dysko
    The wiki I provided shows examples on how to implement a listener in another class. I also recommend learning Java before attempting to get heavily involved in Bukkit.
     
Thread Status:
Not open for further replies.

Share This Page