Solved Howto change whole prefix/suffix/displayname?

Discussion in 'Plugin Development' started by iZanax, Oct 25, 2012.

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

    iZanax

    PHP:
    player.setDisplayName(ChatColor.GOLD+player.getName()+": "+ChatColor.WHITE);
    How do I change it, so the outcome in the chat is
    Player: hi
    instead of
    <Player:> hi
    what it currently is with this piece of code.

    Thanks a lot.
     
  2. Offline

    GRPGamer

    To do that, you need to manipulate minecraft's chat code, I believe, but I am not a clever one in this field, so I will leave someone else to answer this for you.
     
  3. Offline

    HON95

    AsyncPlayerChatEvent

    Assuming you know how to use events, use ev.setFormat(String format) to set the format (obz).
    Code:JAVA
    1. ev.setFormat(ev.getPlayer().getDisplayName() + ": " + ev.getMessage());
     
  4. Offline

    Sagacious_Zed Bukkit Docs

    Why would you not use a format string for the message
     
  5. Offline

    iZanax

  6. Offline

    HON95

    Oh, the "correct" way, I guess:
    Code:JAVA
    1. ev.setFormat("%1$s: %2$s");

    My bad.
     
Thread Status:
Not open for further replies.

Share This Page