Implement Translatable in appropriate places (#6248)

This commit is contained in:
Jake Potrebic
2021-08-13 21:11:12 -07:00
parent 18178d7c9a
commit 112c19b45e
19 changed files with 575 additions and 225 deletions

View File

@@ -12,6 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@
+package com.destroystokyo.paper;
+
+import net.kyori.adventure.translation.Translatable;
+import net.kyori.adventure.util.Index;
+import org.jetbrains.annotations.NotNull;
+
+import org.bukkit.inventory.MainHand;
@@ -36,11 +38,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return type;
+ }
+
+ public enum ChatVisibility {
+ FULL,
+ SYSTEM,
+ HIDDEN,
+ UNKNOWN
+ public enum ChatVisibility implements Translatable {
+ FULL("full"),
+ SYSTEM("system"),
+ HIDDEN("hidden"),
+ UNKNOWN("unknown");
+
+ public static Index<String, ChatVisibility> NAMES = Index.create(ChatVisibility.class, chatVisibility -> chatVisibility.name);
+ private final String name;
+
+ ChatVisibility(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public @NotNull String translationKey() {
+ if (this == UNKNOWN) {
+ throw new UnsupportedOperationException(this.name + " doesn't have a translation key");
+ }
+ return "options.chat.visibility." + this.name;
+ }
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/SkinParts.java b/src/main/java/com/destroystokyo/paper/SkinParts.java