mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-02 05:02:10 -07:00
Implement Translatable in appropriate places (#6248)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user