getMessage() and setMessage()

Discussion in 'Plugin Development' started by 1337, Jan 18, 2011.

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


    how do you use these? i tryed String playermessage = getMessage(); but it didnt work thanks for your help also setMessage("hello"); had an error
  2. Offline


    player.sendmessage("Hey there!");
  3. Offline


    If you want to read the message from a chat event you need to do something like event.getMessage();
  4. Offline


    You would have to use in a chatevent
    public void onPlayerChatEvent(PlayerChatEvent event) {
        String msg = event.getMessage(); // to store the message in a string
        event.setMessage(msg); // Replace msg with whatever you want the player to actually send
    I haven't tested setMessage() myself but I believe that's how it works. On top of the above code, you'll need to import org.bukkit.event.Player.PlayerChatEvent, and register the event in order to catch when a player has sent a message.
  5. Offline


    that worked (well no errors in eclipse) thanks :)
Thread Status:
Not open for further replies.

Share This Page