Solved Send a message from a Player (As if the player typed it himself)

Discussion in 'Plugin Development' started by TomFromCollege, Aug 21, 2013.

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

    TomFromCollege

    Is this possible guys?

    Would firing an event do this? If so, which one? The AsyncEvent or Sync event?
     
  2. Please explain more :)
     
  3. Offline

    TomFromCollege

    I want to send the server a message as if the guy sent it himself.
    Basically, I want the server to do all the normal formatting on the message as if the guy sent it. I want the server to fire all ChatEvents etc...
     
  4. Offline

    Minecrell

  5. Offline

    TomFromCollege

    OH SHIT IT'S A THING!
    Silly Tom.
    Minecrell, Thankyou!
    My flawed attempt:
    Code:java
    1. plugin.getServer().getPluginManager().callEvent(new AsyncPlayerChatEvent(true, (Player) cs, Misc.buildString(strings, " "), new HashSet<Player>()));
    2.  
     
    Minecrell likes this.
  6. Offline

    Pizza371

    TomFromCollege I understand that its solved XD, but wouldn't it be easier to just use player.chat?
     
  7. Offline

    TomFromCollege

    It totally would, that example I showed was my flawed attempt :p Hang on, let me edit my post! :D
     
Thread Status:
Not open for further replies.

Share This Page