Solved translating color codes from config??

Discussion in 'Plugin Development' started by _feedDz, Jun 8, 2014.

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

    _feedDz

    So im making a minigame plugin and i have created a language file. it works the same way a normal config works of course but for some reason when i try to translate color codes it does not work?? my code is this
    Code:java
    1. public class Strings {
    2. static StringsFile language;
    3.  
    4. public Strings(StringsFile instance) {
    5. language = instance;
    6. }
    7.  
    8. static String rawnoperms = language.getLanguage().getString("NoPerms");
    9. public static String noperms = translateAlternateColorCodes('&', rawnoperms);
    10.  
    11.  
    12. }

    i really need help with this! it says translateAlternateColorCodes(char, String); is not aplicable for the type String. well... that kinda what it does is translate color codes from a string back to a string? right?
     
  2. Offline

    fireblast709

    _feedDz Javadocs. Also, your static usage is flawed. Don't use it if you don't know how to use it.
     
    es359 and thomasb454 like this.
  3. Offline

    _feedDz

    fireblast709 i do know how to use it, that was a fix it recomended me to do so :/ idk thanks for the help im testing it now :)

    fireblast709 i still cant seem to get this to work do you mind giving me the code to do so??

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  4. Offline

    theViTALiTY

    Code:java
    1. String noperms = ChatColor.translateAlternateColorCodes('&', rawnoperms);


    Perhaps try it like that?
     
  5. Offline

    _feedDz

    theViTALiTY yea that worked for some reason my eclipse wouldn't let me import ChatColor but it imported Color so i added it manually and sh worked :) thanks!
     
Thread Status:
Not open for further replies.

Share This Page