Solved Args commandless

Discussion in 'Plugin Development' started by Bobfan, Jan 5, 2013.

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

    Bobfan

    How would you get something someone types in chat that isn't a command. (If they type cat without the / it will do something)
     
  2. Offline

    RainoBoy97

    AsyncPlayerChatEvent
     
  3. Offline

    bob7

    Listen for the chatevent, then get the message, then check to see if the message contains the appropriated arguments, if it does, execute.
     
  4. Offline

    chasechocolate

    Something like this (wasn't written with an IDE):
    Code:java
    1. public void onChat(AsyncPlayerChatEvent event){
    2. if(event.getMessage().contains("cat")){
    3. event.getPlayer().sendMessage(ChatColor.GREEN + "Your message had the word 'cat' in it!");
    4. }
    5. }
     
  5. Offline

    Bobfan

    Ty. I thought you could just use a command method, but instead of getting the command, you could just use args.
     
Thread Status:
Not open for further replies.

Share This Page