Solved [HELP] Colored death messages not showing up colored

Discussion in 'Plugin Development' started by Peavalu, Dec 15, 2014.

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

    Peavalu

    Hello guys,

    I've run into yet another problem, apparently when trying to add custom colors to my death message code. The message registers fine, but it just doesn't have it's color.
    Here's my code, I've tried many other tutorials and examples like this one, but they all make no effect on the color of the message. Here's my code!
    Code:
    
         //Death chat customizing
        @EventHandler
        public void onPlayerDeath(PlayerDeathEvent event) {
       
            //gold colored death messages
            String msg = event.getDeathMessage();
            msg = ChatColor.GOLD + msg;
       
            //if killed by person,  else PVE
            if(event.getEntity().getKiller() instanceof Player) {
           
                event.setDeathMessage("[PVP] " + msg);
       
            }
            else {
           
                event.setDeathMessage("[PVE] " + msg);
            }
       
       
       
        }
    
    Any help is appreciated!
    Best regards,
    Peavalu
     
  2. Offline

    leon3001

    @Peavalu Did you register your event(s)?
     
  3. Offline

    Fuzzybear04

    Why have you done:

    String msg = e.getMessage();
    msg = ChatColor.GOLD + msg;

    ?
     
  4. Offline

    Webbeh

    Code:
    event.setDeathMessage(null);
    Bukkit.broadcast("[PVP]"+msg);
    
     
    Peavalu likes this.
  5. Offline

    Peavalu

    Thank you Webbeh, that seemed to be the solution!
     
  6. Offline

    Webbeh

    I'm not sure whether you can actually color a death message triggered by Bukkit or not, I just use that solution that allows better grasp over the messages anyway : personnalized death messages, ability for players to choose if they want to see them or not, etc.
     
Thread Status:
Not open for further replies.

Share This Page