What's the get player chat event????

Discussion in 'Plugin Development' started by gamelord327, Jun 1, 2013.

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

    gamelord327

    Hi, im starting up a new plugin and i need to get the event were the player types a message. I'm a bit of a noob at this so sorry if this sounds stupid of me to ask.
     
  2. Offline

    ZeusAllMighty11

    PlayerChatEvent
    AsyncPlayerChatEvent

    One runs on the main server thread, the other runs in a separate thread. Use it accordingly and safely.
     
  3. Offline

    gamelord327


    Just a quick q, how would i put this into the plugin?
     
  4. Offline

    ZeusAllMighty11

    wiki.bukkit.org/Plugin_Tutorial
     
  5. Offline

    gamelord327

    Ahh yes thank you i think this works now..... you wouldn't also happen to know how to add colour support now would you?
     
  6. Offline

    timtower Administrator Administrator Moderator

  7. Offline

    GodzOfMadness

  8. Offline

    timtower Administrator Administrator Moderator

    I don't? :confused:
     
  9. Offline

    Hoolean

    Nope! :)
     
    timtower likes this.
  10. Offline

    macguy8

    If you were to do ChatColor.GREEN + ChatColor.BOLD it wouldn't compile. The only time you need to use toString() is in a situation such as ChatColor.GREEN.toString() + ChatColor.BOLD which would then compile fine.
     
  11. Offline

    GodzOfMadness

    macguy8 or ChatColor.GREEN + "" + ChatColor.BOLD :p So you don't NEED toString()
     
    Hoolean likes this.
  12. Offline

    Gawdzahh

    Haha I do this all the time, toString() looks alot better though. I might start using that xD
     
  13. Offline

    mikeaaaa

    or : § and than the Color Code . For example: §4Hi = Hi
    This is more easier thant ChatCorlor, and you don't lose much place in your code
     
  14. Offline

    macguy8

    But it can change with MC updates. ChatColor is guaranteed to be updated with Bukkit, so if Mojang changes &b to &c, then your code would have a huge problem. If you use ChatColor.AQUA, you're guaranteed to get aqua, no matter what
     
  15. Offline

    mikeaaaa

    But you can change it easily

    Which EventHandler must I have, when i would check, when a player goes at this cords: x 60 y 60 and z 60
    How can I check that?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  16. PlayerMoveEvent
     
  17. Offline

    RROD

    PlayerChatEvent is deprecated. You'll want to use AsyncPlayerChatEvent. Be sure not to access any of the Bukkit API, only the ones that are permitted for the Event are thread safe.
     
  18. Offline

    macguy8

    Not if you have a couple thousand line plugin.

    Yes, but it still should be used if you need to access the Bukkit API.
     
  19. Offline

    RROD

    No, it shouldn't. There's likely other ways around what you need to get it for. It delays the server from updating.
     
  20. Offline

    Sagacious_Zed Bukkit Docs

    But if you have no idea what you are doing, it is recommended that you use the deprecated PlayerChatEvent.
     
  21. Offline

    mikeaaaa

    Yes And How can I get that, when a player i on specific cords? if(p. ....){
    I dont now
     
  22. @EventHandler
    public void onPlayerMove(PlayerMoveEvent event){
    Player p = event.getPlayer();
    Location l = p.getLocation();
    String w = l.getWorld();
    int x = l.getBlockX();
    int y = l.getBlockY();
    int z = l.getBlockZ();
    if(w.equals("world name") && x = xLoc && y = yLoc && z = zLoc){
    //do stuff
    }
    }
     
Thread Status:
Not open for further replies.

Share This Page