Adding Colors To Config Files

Discussion in 'Plugin Development' started by snake4212, Mar 4, 2013.

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

    snake4212

    I have tried quite a few things to add colors to my config. But everytime I do it the server deletes the &5 in front of my text which obviously changes it to white this is my code can someone please add the code.
    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
    Player player = (Player) sender;
    if(commandLabel.equalsIgnoreCase("info"));
    if(player.hasPermission("ginfo.info"))
    player.sendMessage(getConfig().getString("Info"));
    return false;
     
  2. Offline

    chasechocolate

    Use this to colorize the message:
    Code:java
    1. String info = ChatColor.translateAlternateColorCodes('&', this.getConfig().getString("info"));
    2. player.sendMessage(info);
     
  3. Offline

    snake4212

    Nope Does not work
     
  4. Offline

    chasechocolate

    Does it give errors?
     
  5. Offline

    snake4212

    Nope but the console does
     
  6. Offline

    chasechocolate

    ...and what are those errors?
     
  7. Offline

    ZeusAllMighty11

    Why not just do
    Code:
     public String colorize(String string){
        string = string.replace("&", "ยง");
        return string; // might even be able to do 'return string.replace()'
        } 
    then do colorize(plugin.getConfig().getString("info"));
     
Thread Status:
Not open for further replies.

Share This Page