Solved Config and Chat.Color

Discussion in 'Plugin Development' started by dakoslug, Sep 22, 2012.

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

    dakoslug

    What I'm trying to do: Make the kick message have a customizable color.

    So basically in my plugin's config file..they say which color they'd like the kick message to be, and then covert that color to a value that Chat.Color reconizes and use it.


    What I have attempted thus far;


    String usercolor;
    public void onEnable()
    {
    usercolor = getConfig().getString("Color");
    }

    public void loadConfiguration()
    {
    String path4 = "Color";
    getConfig().addDefault(path4,"Red");
    }
    private void randomKick()
    {
    player.kickPlayer(ChatColor.valueOf(usercolor)+ getConfig().getString("Kickmessage"));
    }

    But the kick message doesn't show up as Red, it still shows up as white.
     
  2. Offline

    Assult

    Whats the point of doing all this?

    Player.kickPlayer(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Kickmessage")));
    The value of Kickmessage should now be something like this;
    &1kickmessageHere
     
    ferrybig likes this.
  3. Offline

    ThatBox

    Assult
    Has the right idea. :>
     
  4. Offline

    dakoslug

    See i do this
    ConvertedUserColor = ChatColor.translateAlternateColorCodes('&', getConfig().getString("Kickmessage"));
    But everytime I test this, it keeps alterting my kickmessage.

    Original Kick Message: &4Kicking You out of server

    After Server Start: You out of Server

    and the kickmessage remains white.
     
  5. Offline

    Assult

    Post your code
     
  6. Offline

    dakoslug

    ConvertedUserColor = ChatColor.translateAlternateColorCodes('&', getConfig().getString("Kickmessage"));

    player.kickPlayer(ConvertedUserColor);


    I dont think there's anything else
     
  7. Offline

    Assult

    I forgot to tell you, the message should be something like this; "&4mesaage". WITH the qoutes
     
    dakoslug likes this.
  8. Offline

    dakoslug

    Thanks!
     
  9. Offline

    EmpororerBaba

    Wouldn't it be something like this: player.sendMessage(' "Message" ')
    Not entirely sure in Java though
     
Thread Status:
Not open for further replies.

Share This Page