Skip to content

Commit f11d22e

Browse files
committed
Deprecate ChatVisibility#UNKNOWN
1 parent cb2ab7d commit f11d22e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

patches/api/0183-Add-Player-Client-Options-API.patch

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Subject: [PATCH] Add Player Client Options API
66

77
diff --git a/src/main/java/com/destroystokyo/paper/ClientOption.java b/src/main/java/com/destroystokyo/paper/ClientOption.java
88
new file mode 100644
9-
index 0000000000000000000000000000000000000000..7af28d6ba27c97a87ffbb9db03a5c340277853cc
9+
index 0000000000000000000000000000000000000000..a54fd09c2986761bba3c25e1476472c3cc3dd9c1
1010
--- /dev/null
1111
+++ b/src/main/java/com/destroystokyo/paper/ClientOption.java
12-
@@ -0,0 +1,70 @@
12+
@@ -0,0 +1,76 @@
1313
+package com.destroystokyo.paper;
1414
+
1515
+import net.kyori.adventure.translation.Translatable;
@@ -44,6 +44,12 @@ index 0000000000000000000000000000000000000000..7af28d6ba27c97a87ffbb9db03a5c340
4444
+ FULL("full"),
4545
+ SYSTEM("system"),
4646
+ HIDDEN("hidden"),
47+
+ /**
48+
+ * @deprecated no longer used anymore since 1.15.2, the value fallback
49+
+ * to the default value of the setting when unknown on the server.
50+
+ * In this case {@link #FULL} will be returned.
51+
+ */
52+
+ @Deprecated(since = "1.15.2")
4753
+ UNKNOWN("unknown");
4854
+
4955
+ public static final Index<String, ChatVisibility> NAMES = Index.create(ChatVisibility.class, chatVisibility -> chatVisibility.name);

patches/server/0337-Implement-Player-Client-Options-API.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ index 0c68c0a9ec9b353b353eff0c36af2993df5f59b3..eebf44c7124c4f48b6d48562a00633b1
133133
this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper
134134
this.requestedViewDistance = clientOptions.viewDistance();
135135
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
136-
index b3b13f1baea0b170fd4f1546689aad40f53d3c27..8cfcd8797d056be07b09ec9627bc35bf75eb0d2d 100644
136+
index b3b13f1baea0b170fd4f1546689aad40f53d3c27..59e291d7552e20b960faa7d679cf69981458c139 100644
137137
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
138138
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
139139
@@ -658,6 +658,30 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -148,7 +148,7 @@ index b3b13f1baea0b170fd4f1546689aad40f53d3c27..8cfcd8797d056be07b09ec9627bc35bf
148148
+ } else if (com.destroystokyo.paper.ClientOption.CHAT_COLORS_ENABLED == type) {
149149
+ return type.getType().cast(this.getHandle().canChatInColor());
150150
+ } else if (com.destroystokyo.paper.ClientOption.CHAT_VISIBILITY == type) {
151-
+ return type.getType().cast(this.getHandle().getChatVisibility() == null ? com.destroystokyo.paper.ClientOption.ChatVisibility.UNKNOWN : com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(this.getHandle().getChatVisibility().name()));
151+
+ return type.getType().cast(com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(this.getHandle().getChatVisibility().name()));
152152
+ } else if (com.destroystokyo.paper.ClientOption.LOCALE == type) {
153153
+ return type.getType().cast(this.getLocale());
154154
+ } else if (com.destroystokyo.paper.ClientOption.MAIN_HAND == type) {

0 commit comments

Comments
 (0)