mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 12:48:53 +01:00
Deprecate ChatVisibility#UNKNOWN (#11683)
This commit is contained in:
parent
5ab678947f
commit
47f2071350
2 changed files with 10 additions and 4 deletions
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add Player Client Options API
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java
|
diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..7af28d6ba27c97a87ffbb9db03a5c340277853cc
|
index 0000000000000000000000000000000000000000..290bde7050f43cb5cd6c0cea9eb7a05297536dec
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/ClientOption.java
|
+++ b/src/main/java/com/destroystokyo/paper/ClientOption.java
|
||||||
@@ -0,0 +1,70 @@
|
@@ -0,0 +1,76 @@
|
||||||
+package com.destroystokyo.paper;
|
+package com.destroystokyo.paper;
|
||||||
+
|
+
|
||||||
+import net.kyori.adventure.translation.Translatable;
|
+import net.kyori.adventure.translation.Translatable;
|
||||||
|
@ -44,6 +44,12 @@ index 0000000000000000000000000000000000000000..7af28d6ba27c97a87ffbb9db03a5c340
|
||||||
+ FULL("full"),
|
+ FULL("full"),
|
||||||
+ SYSTEM("system"),
|
+ SYSTEM("system"),
|
||||||
+ HIDDEN("hidden"),
|
+ HIDDEN("hidden"),
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated no longer used anymore since 1.15.2, the value fallback
|
||||||
|
+ * to the default value of the setting when unknown on the server.
|
||||||
|
+ * In this case {@link #FULL} will be returned.
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(since = "1.15.2", forRemoval = true)
|
||||||
+ UNKNOWN("unknown");
|
+ UNKNOWN("unknown");
|
||||||
+
|
+
|
||||||
+ public static final Index<String, ChatVisibility> NAMES = Index.create(ChatVisibility.class, chatVisibility -> chatVisibility.name);
|
+ public static final Index<String, ChatVisibility> NAMES = Index.create(ChatVisibility.class, chatVisibility -> chatVisibility.name);
|
||||||
|
|
|
@ -133,7 +133,7 @@ index 0c68c0a9ec9b353b353eff0c36af2993df5f59b3..eebf44c7124c4f48b6d48562a00633b1
|
||||||
this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper
|
this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper
|
||||||
this.requestedViewDistance = clientOptions.viewDistance();
|
this.requestedViewDistance = clientOptions.viewDistance();
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index b3b13f1baea0b170fd4f1546689aad40f53d3c27..8cfcd8797d056be07b09ec9627bc35bf75eb0d2d 100644
|
index b3b13f1baea0b170fd4f1546689aad40f53d3c27..59e291d7552e20b960faa7d679cf69981458c139 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -658,6 +658,30 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -658,6 +658,30 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
@ -148,7 +148,7 @@ index b3b13f1baea0b170fd4f1546689aad40f53d3c27..8cfcd8797d056be07b09ec9627bc35bf
|
||||||
+ } else if (com.destroystokyo.paper.ClientOption.CHAT_COLORS_ENABLED == type) {
|
+ } else if (com.destroystokyo.paper.ClientOption.CHAT_COLORS_ENABLED == type) {
|
||||||
+ return type.getType().cast(this.getHandle().canChatInColor());
|
+ return type.getType().cast(this.getHandle().canChatInColor());
|
||||||
+ } else if (com.destroystokyo.paper.ClientOption.CHAT_VISIBILITY == type) {
|
+ } else if (com.destroystokyo.paper.ClientOption.CHAT_VISIBILITY == type) {
|
||||||
+ return type.getType().cast(this.getHandle().getChatVisibility() == null ? com.destroystokyo.paper.ClientOption.ChatVisibility.UNKNOWN : com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(this.getHandle().getChatVisibility().name()));
|
+ return type.getType().cast(com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(this.getHandle().getChatVisibility().name()));
|
||||||
+ } else if (com.destroystokyo.paper.ClientOption.LOCALE == type) {
|
+ } else if (com.destroystokyo.paper.ClientOption.LOCALE == type) {
|
||||||
+ return type.getType().cast(this.getLocale());
|
+ return type.getType().cast(this.getLocale());
|
||||||
+ } else if (com.destroystokyo.paper.ClientOption.MAIN_HAND == type) {
|
+ } else if (com.destroystokyo.paper.ClientOption.MAIN_HAND == type) {
|
||||||
|
|
Loading…
Reference in a new issue