Chat Event Send a "Say" as a user

Discussion in 'Plugin Development' started by boduzapho, Jan 19, 2012.

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

    boduzapho

    I am creating a plugin that sends a message as a say from the player who issues the slash command, like /joke and the system would create a "say" in chat as that user with a random joke. I am having a hard time finding the API for different types of chat messages that I can send, like a "say" as opposed to a "msg".

    Any help would be appreciated!
     
  2. Offline

    Zacherl

    Just use player.sendMessage(). You can make it look like the default "say" message by adding the correct color and formatting.
     
  3. I assume you want the message to be broadcasted to all players.
    Then use: server.broadcastMessage(String msg)
     
  4. Offline

    obnoxint

  5. Offline

    boduzapho

    No I want only people in range to see it, and I'm writing plugins from scratch I don't want to use a pre-defined plugin
     
  6. Offline

    Royal_Soda

    boduzapho
    Code:
    plr.getServer().broadcastMessage(ChatColor.LIGHT_PURPLE + "[Server] Insert Joke Here.");
     
  7. Offline

    boduzapho

    Something like hero chat where a say has a 300 block radius, anyone outside of those 300 blocks cannot see it
     
  8. Offline

    Zacherl

    So whats the problem? If i remember correctly, there is a getNearbyEntities() api. If not, you could just loop through the online player list, get their locations and calculate the distance by yourself.
     
  9. Offline

    Lolmewn

    Or get all nearby entities and check if they are players. If so, cast it to Player and send them a message.
     
  10. Offline

    boduzapho

    Okay so there is no system that restricts chat by distance, for example, most MMO's use say for the immediate area, and a yell which can be seen further away and of course a world type that everyone sees. I'm new to minecraft but not programming or MMO's and was not sure if it used a similar system.
     
  11. Offline

    boduzapho

    This has been resolved (a long time ago) sorry for the late update.
     
Thread Status:
Not open for further replies.

Share This Page