Changing chat format

Discussion in 'Plugin Development' started by tylerthecreeper1, Mar 30, 2015.

Thread Status:
Not open for further replies.
  1. I'm making a plugin, and I'm trying to change the chat format in it. I have this so far, but it's not working, and I realize why, just I can't figure out how to fix it..

        public void chatFormat(AsyncPlayerChatEvent e) {
            String format = "<points><name>: <message>";
            format.replace("<points>", ChatColor.GRAY + "[" + ChatColor.WHITE + Points.getPoints(e.getPlayer()) + ChatColor.GRAY + "]" + ChatColor.RESET);
            format.replace("<name>", e.getPlayer().getDisplayName() + ChatColor.DARK_GRAY);
            format.replace("<message>", ChatColor.RESET + e.getMessage());
            e.setMessage(format + e.getMessage());
    When I use this, whenever I send a message it shows the "<points><name>: <message>"..

    Any help appreciated. Thanks in advance.
  2. Offline


    Because you're not setting the variable "format" to the value of the replaced text.

    You should be using it like:

    format = format.replace("Something", words);
    WingedMLGPro likes this.
Thread Status:
Not open for further replies.

Share This Page