How to check if a player executed any command?

Discussion in 'Plugin Development' started by Niknea, Jan 6, 2014.

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

    Niknea

    Hey guys I was wondering how I can make it to check if a player executed any command then kill then. Also would it b e possible to exclude one command? So if they type that one command nothing will happen, however if they type any other ( valid ) command it will kill them?

    Thanks again
     
  2. Offline

    Tirelessly

    Niknea Use PlayerCommandPreprocessEvent
     
  3. Offline

    Niknea

  4. Offline

    Tirelessly

  5. Offline

    Tythus

    or you could do
    Code:java
    1. if(sender instanceof Player){
    2. p = sender.getServer().getPlayer(sender.getName());
    3. }
     
  6. Offline

    Niknea

    Tirelessly What if I want ALL the commands but ONE?
     
  7. Offline

    Gater12

    Niknea
    Then check if the message is not that one command.
     
  8. Offline

    Drkmaster83

    Or even better, you can force cast the sender to a Player object, since the Player object extends CommandSender.
    Code:
    Player player = (Player) sender;
    
     
Thread Status:
Not open for further replies.

Share This Page