aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMoulberry <[email protected]>2024-02-10 04:30:50 +0800
committerGitHub <[email protected]>2024-02-09 20:30:50 +0000
commit534659e97ef85308ff3facc00fb5e11f7b9b96f5 (patch)
tree173265069d99c456ec9c88338d624cbb007be4aa
parent934cd77da81b452770530c7690393648e1bb620b (diff)
downloadPaper-534659e97ef85308ff3facc00fb5e11f7b9b96f5.tar.gz
Paper-534659e97ef85308ff3facc00fb5e11f7b9b96f5.zip
Fix NotNull locales (#10216)
Two methods returning locales are annotated @NotNull, despite being able to return null
-rw-r--r--patches/api/0006-Adventure.patch4
-rw-r--r--patches/server/0010-Adventure.patch6
-rw-r--r--patches/server/0353-Implement-Player-Client-Options-API.patch6
3 files changed, 8 insertions, 8 deletions
diff --git a/patches/api/0006-Adventure.patch b/patches/api/0006-Adventure.patch
index c48be7bc32..1dbe876202 100644
--- a/patches/api/0006-Adventure.patch
+++ b/patches/api/0006-Adventure.patch
@@ -3586,7 +3586,7 @@ index 2f6ca42330675733b2b4132cbb66e433788d05d5..997b06c19a5277656521e0e298f2958c
@NotNull
diff --git a/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
-index 36b436e145a7215682b692a87ab894df25752c1d..c5e8bffef736365881953161ff812c98adf93a80 100644
+index 36b436e145a7215682b692a87ab894df25752c1d..dc6b41950570c3a8b02415dd9017b2336e6e7f0c 100644
--- a/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java
@@ -12,17 +12,31 @@ public class PlayerLocaleChangeEvent extends PlayerEvent {
@@ -3608,7 +3608,7 @@ index 36b436e145a7215682b692a87ab894df25752c1d..c5e8bffef736365881953161ff812c98
public PlayerLocaleChangeEvent(@NotNull Player who, @NotNull String locale) {
super(who);
this.locale = locale;
-+ this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(locale); // Paper
++ this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(locale), java.util.Locale.US); // Paper start
}
/**
diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch
index 539a3360c9..8d235e570c 100644
--- a/patches/server/0010-Adventure.patch
+++ b/patches/server/0010-Adventure.patch
@@ -2745,7 +2745,7 @@ index 0c77b4b201f6586b4d143ce2c3e710bf9d276a20..3691fd58c7baf98b15c50fa4dacf3a35
public boolean logIPs() {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index a721e9cd0958d7fceed1aba8ae55fefed4e6a887..61d4afb6b76fdffdda9f01af5005f005e21f4807 100644
+index a721e9cd0958d7fceed1aba8ae55fefed4e6a887..27a1450696a633578cd44567f240cbc1a4c578ac 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -162,6 +162,7 @@ import net.minecraft.world.damagesource.CombatTracker;
@@ -2826,7 +2826,7 @@ index a721e9cd0958d7fceed1aba8ae55fefed4e6a887..61d4afb6b76fdffdda9f01af5005f005
}
// CraftBukkit end
this.language = clientOptions.language();
-+ this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(this.language); // 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.chatVisibility = clientOptions.chatVisibility();
this.canChatColor = clientOptions.chatColors();
@@ -3354,7 +3354,7 @@ index 23bdb77690ba15bcbbfb0c70af23336d08ac7752..8f144a357174bbe096ac9b38a5e67a61
}
collection = icons;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
-index 5ee460d5d6e017a52bf26cfd56ca2cfeb82d3343..a381673d2397bcb3569e0b24eb071d86afa709ac 100644
+index e51bed4771dcef6201f943e9289c4a53f029f1ab..c9453c4689d02a39fa4a01aa14fc8d8aa29bc887 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -608,8 +608,10 @@ public final class CraftServer implements Server {
diff --git a/patches/server/0353-Implement-Player-Client-Options-API.patch b/patches/server/0353-Implement-Player-Client-Options-API.patch
index 12e24a1ee2..e86b98caa5 100644
--- a/patches/server/0353-Implement-Player-Client-Options-API.patch
+++ b/patches/server/0353-Implement-Player-Client-Options-API.patch
@@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index f6d266c5b279a22dee273cda109866b627e706da..6e3a791c4623ee904c3348ad7be5ede4b1657a12 100644
+index 347747282c77f5d1dde907b99cc2c8029675dc34..eb0a0a9faacf3c7d879b435b637a9c8203319aa6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -338,7 +338,7 @@ public class ServerPlayer extends Player {
@@ -133,10 +133,10 @@ index f6d266c5b279a22dee273cda109866b627e706da..6e3a791c4623ee904c3348ad7be5ede4
+ public void updateOptionsNoEvents(ClientInformation clientOptions) {
+ // Paper end
this.language = clientOptions.language();
- this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(this.language); // 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();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index 1c8e4e3c53acc1c3043cb015cbe504f4cfb7a35c..549c14e2d861c0b4692ee56e1de5df13ef72f6f8 100644
+index 473017107d80aa1467cd2f9400e8d48e39fab7e2..dcea3f827a79de3581adff51f34220a1d656e8e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -567,6 +567,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {