[Solved]Simple question about PlayerChatEvent

Discussion in 'Plugin Development' started by woutwoot, Jun 2, 2012.

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

    woutwoot

    Well, my plugin is responding to something the player says.
    When I use this code, the message the plugin says appears before my chat message?

    Code:
        @EventHandler
        public void onPlayerChat(PlayerChatEvent event){
            event.getPlayer().sendMessage("This is appearing above the original message?")
        }
    How do I get it to appear after the original message, and not before?
     
  2. use the scheduler and a delayedTask. http://wiki.bukkit.org/Scheduler_Programming
    Then it would get executed within the next tick, i.e. after the event.
     
  3. woutwoot but before you use the task, try setting event's priority to MONITOR first, I'm curious if that works... but I kinda doubt it tough.
     
  4. Offline

    woutwoot

    Thanks, delayed task worked. Now my new plugin is finished :D Digi sorry, to late to try :)
     
  5. Offline

    Njol

    This won't work since all listeners (including those on monitor level) are called before the event is executed.
     
  6. Njol Yeah but I was curious if there was a special method for monitor priority... it should be tough, to prevent people from changing stuff in monitor events.
     
Thread Status:
Not open for further replies.

Share This Page