Problem with PlayerChatEvent

Discussion in 'Plugin Development' started by regzand, Jun 5, 2012.

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

    regzand

    This is in Bukkit Documentation:
    class PlayerChatEvent
    Holds information for player chat and commands. More...


    But when I run this:
    Code:
    @EventHandler (priority = EventPriority.LOWEST)
    public void onPlayerChat(PlayerChatEvent event) {
            event.getPlayer().sendMessage("Napisales cos na czacie...");
    }
    it does not work with commands.
    Someone has an idea why?
     
  2. Offline

    SirTyler

    Did you remember to register the listener?
     
  3. Offline

    Njol

    Use PlayerCommandPreprocess, which is a subclass of PlayerChatEvent. It seems as if chat events are not called for command, even though usually subclasses of an event also call the superclass(es) (e.g. PlayerDeathEvent and EntityDeathEvent both get called when a player dies)
     
    regzand likes this.
  4. Offline

    regzand

    Yes, it works with normal message...

    It works! Thanks a lot [diamond]
     
Thread Status:
Not open for further replies.

Share This Page