Try load changed version if possible
This commit is contained in:
		| @@ -302,13 +302,17 @@ public enum LibsMsg { | ||||
|     LibsMsg(String string) { | ||||
|         this.string = string; | ||||
|  | ||||
|         if (!DisguiseUtilities.hasAdventureTextSupport()) { | ||||
|             for (ChatColor c : ChatColor.values()) { | ||||
|                 string = string.replaceAll("<" + c.name().toLowerCase(Locale.ROOT) + ">", "§" + c.getChar()); | ||||
|             } | ||||
|         useString = DisguiseUtilities.hasAdventureTextSupport() ? string : getVanillaFormat(); | ||||
|     } | ||||
|  | ||||
|         useString = string; | ||||
|     public String getVanillaFormat() { | ||||
|         String raw = getRaw(); | ||||
|  | ||||
|         for (ChatColor c : ChatColor.values()) { | ||||
|             raw = raw.replace("<" + c.name().toLowerCase(Locale.ROOT) + ">", "§" + c.getChar()); | ||||
|         } | ||||
|  | ||||
|         return raw; | ||||
|     } | ||||
|  | ||||
|     public String getRaw() { | ||||
|   | ||||
| @@ -107,7 +107,7 @@ public class TranslateFiller { | ||||
|                 .save("DisgiseType", "Used for the disgiuse modify radius command to list all " + "disguisetypes"); | ||||
|  | ||||
|         for (LibsMsg msg : LibsMsg.values()) { | ||||
|             TranslateType.MESSAGES.save(DisguiseUtilities.translateAlternateColorCodes(msg.getRaw()), "Reference: " + msg.name()); | ||||
|             TranslateType.MESSAGES.save(msg, DisguiseUtilities.translateAlternateColorCodes(msg.getRaw()), "Reference: " + msg.name()); | ||||
|         } | ||||
|  | ||||
|         for (TranslateType type : TranslateType.values()) { | ||||
|   | ||||
| @@ -135,15 +135,31 @@ public enum TranslateType { | ||||
|     } | ||||
|  | ||||
|     public void save(String message, String comment) { | ||||
|         String sanitized = StringEscapeUtils.escapeJava(message.replace(ChatColor.COLOR_CHAR + "", "&")); | ||||
|         save(null, message, comment); | ||||
|     } | ||||
|  | ||||
|         toDeDupe.put(sanitized, false); | ||||
|     public void save(LibsMsg orig, String message, String comment) { | ||||
|         toDeDupe.put(StringEscapeUtils.escapeJava(message.replace("§", "&")), false); | ||||
|  | ||||
|         if (translated.containsKey(message)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         translated.put(message, message); | ||||
|         String value = message; | ||||
|  | ||||
|         if (orig != null) { | ||||
|             String vanilla = orig.getVanillaFormat(); | ||||
|  | ||||
|             if (translated.containsKey(vanilla) && !vanilla.equals(message) && !translated.get(vanilla).equals(vanilla)) { | ||||
|                 value = translated.get(vanilla); | ||||
|  | ||||
|                 for (ChatColor color : ChatColor.values()) { | ||||
|                     value = value.replace("§" + color.getChar(), "<" + color.name().toLowerCase(Locale.ROOT) + ">"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         translated.put(message, value); | ||||
|  | ||||
|         try { | ||||
|             boolean exists = getFile().exists(); | ||||
| @@ -169,7 +185,10 @@ public enum TranslateType { | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             writer.write("\n" + (comment != null ? "# " + comment + "\n" : "") + "\"" + sanitized + "\": \"" + sanitized + "\"\n"); | ||||
|             String sanitizedKey = StringEscapeUtils.escapeJava(message.replace("§", "&")); | ||||
|             String sanitized = StringEscapeUtils.escapeJava(value.replace("§", "&")); | ||||
|  | ||||
|             writer.write("\n" + (comment != null ? "# " + comment + "\n" : "") + "\"" + sanitizedKey + "\": \"" + sanitized + "\"\n"); | ||||
|             written++; | ||||
|         } catch (Exception ex) { | ||||
|             ex.printStackTrace(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user