Solved Help with player chat event

Discussion in 'Spigot Plugin Development' started by bradley13, Jun 7, 2016.

  1. Hey there, I am trying to make a event that checks if the player type the message "Poll 1". I do not know what chat event does this and I don't know how to check what he/she say. I am new to chat related events and I was wondering if anyone could help me? Thank you all in advanced for any help you give me!
     
  2. I'm gonna be an asshole and tell you how to do it.
    What I would do is:
    Code (Text):
    @EventHandler
      public void AsyncChatEvent(AsyncPlayerChatEvent e) {
          if (e.getMessage().equalsIgnoreCase("Poll 1")) {
              //Code goes here
          }
      }
    Instead of AsyncPlayerChatEvent you can also use PlayerChatEvent.
     
  3. He needs to learn the API and java first.... ;-;
     
  4. I might not know it better, but according tho this

    https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerChatEvent.html (2016-06-07)

    you should not use it.
     
  5. Sometimes the best way for people to learn is to try and if they get stuck, ask...
    People were happy to help so there was really no need to post this.
     
    • Agree Agree x 2
  6. Thank you all for suggestions but I have done it by using PlayerChatEvent. And @fujiboy4 if you are going to say that then say nothing at all :)
     
    • Optimistic Optimistic x 3
    • Like Like x 1
    • Agree Agree x 1