How to disable commands

Discussion in 'Plugin Development' started by Patrik8008, Dec 7, 2013.

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

    Patrik8008

    How to make like in bow spleef:
    [BowSpleef]You can't use commands while in arena
    I'm developing parkour plugin and i want to they want do anything except /parkour leave while in parkour?
    How would I do that?
     
  2. Offline

    Wolfey

    You make a PlayerCommandPreProcessEvent, then e.setCancelled(true);
    Code:java
    1.  
    2. @EventHandler
    3. public void onPlayerCommand(PlayerCommandPreprocessEvent) {
    4. if(e.getMessage().equalsIgnoreCase("/parkour")) {
    5. return;
    6. }
    7. if(minigame.getPlayers().contains(e.getPlayer().getName())) {
    8. e.setCancelled(true);
    9. }
    10. }
    11.  
     
Thread Status:
Not open for further replies.

Share This Page