Forge Message (Fake Chat Message)

Discussion in 'Plugin Development' started by GeekPlaya, 12, 2011.

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


    My 3rd topic of the day for my 3rd main question of the day...

    How do you forge a chat message so that the server believes a player SENT it and TREATS it like a chat message?
    GeekPlaya likes this.
  3. Offline


    But how would I append things such as recipients, etc.?
  4. Catch it in onPlayerChat and do stuff to it.
  5. Offline


    Ok, let me try.

    Well, I tried:
    PlayerChatEvent ch = new PlayerChatEvent(p.getServer().getPlayer("GeekPlaya"), m);
    That didn't work... seems like it should though :p Any ideas?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: 20, 2016
  6. No, you don't create a player chat event. I mean create a listener and catch the event, then do what you want.
  7. Offline


    Darn! I really wish I knew what you were talking about so I wouldn't be pestering you any more..

    I'm not sure if I am experienced enough to understand how to set such a thing up..

    I put that line within:
    public void onPlayerChat(PlayerChatEvent chat) {
  8. first"HERRO WORLD");
    public void onPlayerChat(PlayerChatEvent event) {
    if (event.getMessage().equals(messageYouWant) && event.getSender().equals(thePlayerWhoSentIt)) {
    // Might be event.getPlayer(), don't remember
    //Do stuff here
Thread Status:
Not open for further replies.

Share This Page