Solved BundleResource ?

Discussion in 'Spigot Plugin Development' started by Banbeucmas, May 25, 2016.

  1. Ok, I would need some help here, so I have trying to use the Java BundleResouce for my plugin language
    By storing the locale (in String) in the config.yml
    I have created a (Default in the config.yml)

    Now This is the problem, when i change the Locale value in the config.yml, and even with restarting the server, It would still use en_US locale, anyway to fix this?
  2. MiniDigger


    how are you loading the properties? we need some code ^^
  3. No we have no code so we don't know.

    EDIT: Freaking ninjad by a gold digger :/ (Jk lmao take it easy, rustaaagh)
    Main class, check the getLanguageString();

    GeneralData class

    Config.yml (Also

    Now i am so dumb with this, whenever i change the Locale into vi_VN, and then restart the server, it would still use en_US
  5. Bump guys, sorry saw this at the end of the 1st page XD
  6. Don't nump within 24 hours. Please be patient.
  7. Code (Java):
    final Properties properties = new Properties();
    try(finalInputStream stream = this.getClass().getClassLoader().getResourceAsStream("/Language" + locale + ".properties")){
    I'd rather use one of those to load the actual properties, and then just use that for every time you'll get the new property from the file.
  8. Wait, so how do i get the msg then?
  9. I got an NPE on doing that, steam is null somehow
    Code (Text):
    final InputStream stream=this.getClass().getClassLoader().getResourceAsStream("/Language_" + config.getString("Locale") + ".properties");
    Edit: nvm, i will just use pl.getClass().getResourceAsSteam();

    Problem solved anyway, i will stick to Properties() then
    #11 Banbeucmas, May 26, 2016
    Last edited: May 26, 2016