[Sloved] How to disable commands during minigame.

Discussion in 'Spigot Plugin Development' started by DeveloperITA, Jul 4, 2015.

  1. I'm creating a minigame. I need to disable chat and commands during the game. You can only leave the match using a object in your inventory. I know, i can make this with a worldguard flag, but i can't display a custom message. So.. Is there a way to dosable commands? Thank you!
  2. Use the command process event & cancel it if they're in game.
  3. Using the command preprocess event, you can check if the player is in-game

    if(e.getPlayer().getSomeConfigSettingorHashMap == true){
  4. Just have a variable
    List<String> someList = new ArrayList<String>();
    then cancel the event

    and when someone joins the minigame just add them to the list, when they leave remove them and when it ends, clear the list.
  5. As others already said, using an enum and the "CommandPreprocessEvent" should pe perfectly suitable for this.