Add color code support in lang files (Fixes #5)

This commit is contained in:
Michael Smith 2020-09-01 05:10:22 -07:00
parent 654ddefb6e
commit 9f71eeb08b
No known key found for this signature in database
GPG Key ID: 41F47A53EDE95BE1

View File

@ -1,5 +1,7 @@
package net.TheDgtl.Stargate; package net.TheDgtl.Stargate;
import org.bukkit.ChatColor;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
@ -120,7 +122,7 @@ public class LangLoader {
updated = true; updated = true;
} else { } else {
keyList.add(key); keyList.add(key);
valList.add("=" + curLang.get(key)); valList.add("=" + curLang.get(key).replace('\u00A7', '&'));
curLang.remove(key); curLang.remove(key);
} }
line = br.readLine(); line = br.readLine();
@ -187,8 +189,8 @@ public class LangLoader {
continue; continue;
} }
String key = line.substring(0, eq); String key = line.substring(0, eq);
String val = line.substring(eq + 1); String val = ChatColor.translateAlternateColorCodes('&', line.substring(eq + 1));
strings.put(key, val); strings.put(key, val);
line = br.readLine(); line = br.readLine();
} }
} catch (Exception ex) { } catch (Exception ex) {