mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-30 12:29:16 +00:00
clean: change TranslationPair to a record
This commit is contained in:
@@ -1,20 +1,5 @@
|
||||
package com.hibiscusmc.hmccosmetics.util;
|
||||
|
||||
public class TranslationPair {
|
||||
public record TranslationPair(String key, String value) {
|
||||
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
public TranslationPair(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class TranslationUtil {
|
||||
pairs.add(pair);
|
||||
MessagesUtil.sendDebugMessages("setupTranslation key:" + node.key().toString() + " | " + node);
|
||||
MessagesUtil.sendDebugMessages("Overall Key " + node.key().toString());
|
||||
MessagesUtil.sendDebugMessages("Key '" + pair.getKey() + "' Value '" + pair.getValue() + "'");
|
||||
MessagesUtil.sendDebugMessages("Key '" + pair.key() + "' Value '" + pair.value() + "'");
|
||||
}
|
||||
keys.put(node.key().toString().toLowerCase(), pairs);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class TranslationUtil {
|
||||
public static String getTranslation(String key, String message) {
|
||||
List<TranslationPair> pairs = keys.get(key);
|
||||
for (TranslationPair pair : pairs) {
|
||||
if (pair.getKey() == message) return StringUtils.parseStringToString(pair.getValue());
|
||||
if (pair.key() == message) return StringUtils.parseStringToString(pair.value());
|
||||
}
|
||||
|
||||
return message;
|
||||
|
||||
Reference in New Issue
Block a user