Disable use of commands whilst playing mini-game

Discussion in 'Plugin Development' started by PabiGamito, Nov 13, 2013.

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

    PabiGamito

    I am currently wanting to modify a mini game plugin (http://dev.bukkit.org/bukkit-plugins/splegg-game/) to make is so you can't use commands when you are playing the game. I do know the basics of java, as I have already coded my minecraft mod (http://www.minecraftforum.net/topic/1893407-162-pabis-magic-mod-forge/). This plugin is open source so I grabbed the source code from github (https://github.com/njb-said/Splegg) and downloaded it onto my desktop. Then I imported it in an eclipse java project.

    But I can't seem to find a way to disable all commands when a player is playing the game, so that they can't use /spawn, /tpa, and other commands so they can leave the game and still be playing. Maybe I haven't though this through enough, but if anyone could help I would be really happy.

    Thank you in advance.
     
  2. Offline

    Nibbur

    put the players that are in the minigame in a hashmap and ad ad if(!hashmap.containskey(sender)){ all your command if's} under the onCommand void
     
  3. Offline

    FireBreath14

    Inside a CommandPreprocessEvent listener:

    if (a player is playing your game){
    if(!cmd.getName().equalsIgnoreCase("your command")){
    e.setCancelled(true);
    }
    }
     
Thread Status:
Not open for further replies.

Share This Page