Use implementation-provided legacy serializer for events

This commit is contained in:
Riley Park 2021-03-08 17:11:17 -08:00
parent 27a8d99ec4
commit 7f72c4675b
No known key found for this signature in database
GPG Key ID: D831AF236C834E45
20 changed files with 137 additions and 111 deletions

View File

@ -809,6 +809,18 @@ index 768f35c19c4557236bded5f4a85f48a2b2b2a9e6..d0ce64412276512cde133937a85a3340
+ } + }
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..dd0b80c268644ac714311501215f45166092b856 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -17,6 +17,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
*/
@Deprecated
public interface UnsafeValues {
+ net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); // Paper
void reportTimings(); // Paper
Material toLegacy(Material material);
diff --git a/src/main/java/org/bukkit/Warning.java b/src/main/java/org/bukkit/Warning.java diff --git a/src/main/java/org/bukkit/Warning.java b/src/main/java/org/bukkit/Warning.java
index efb97712cc9dc7c1e12a59f5b94e4f2ad7c6b7d8..3024468af4c073324e536c1cb26beffb1e09f3f4 100644 index efb97712cc9dc7c1e12a59f5b94e4f2ad7c6b7d8..3024468af4c073324e536c1cb26beffb1e09f3f4 100644
--- a/src/main/java/org/bukkit/Warning.java --- a/src/main/java/org/bukkit/Warning.java
@ -924,7 +936,7 @@ index 7e3cf00e49c66023bf46c298ef46c00e8c3c2caf..6ea9b54d95d80070c01a612c0ce2ab37
/** /**
diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java
index ac772bf349e0ffe9cab1df165d9460b387f2fe69..2588edf75483855e0c843834f39ca371770730b9 100644 index ac772bf349e0ffe9cab1df165d9460b387f2fe69..c88418c7aa19b4fecdfa9af3d18ff202a5dc5763 100644
--- a/src/main/java/org/bukkit/command/CommandSender.java --- a/src/main/java/org/bukkit/command/CommandSender.java
+++ b/src/main/java/org/bukkit/command/CommandSender.java +++ b/src/main/java/org/bukkit/command/CommandSender.java
@@ -6,12 +6,13 @@ import org.bukkit.permissions.Permissible; @@ -6,12 +6,13 @@ import org.bukkit.permissions.Permissible;
@ -1014,7 +1026,7 @@ index ac772bf349e0ffe9cab1df165d9460b387f2fe69..2588edf75483855e0c843834f39ca371
+ // Paper start + // Paper start
+ @Override + @Override
+ default void sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { + default void sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) {
+ this.sendMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message)); + this.sendMessage(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(message));
+ } + }
+ // Paper end + // Paper end
} }
@ -1460,7 +1472,7 @@ index 63c80b4ee1f7adc8a9efc3b607993104b1991f90..91cab8b13d5bba34007f124838b32a1d
} }
diff --git a/src/main/java/org/bukkit/event/block/SignChangeEvent.java b/src/main/java/org/bukkit/event/block/SignChangeEvent.java diff --git a/src/main/java/org/bukkit/event/block/SignChangeEvent.java b/src/main/java/org/bukkit/event/block/SignChangeEvent.java
index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1268066e30ddb0cd3792ea4b3de894eb04196669 100644 index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1f79f704abf339150df08900b8ea7da4cefef258 100644
--- a/src/main/java/org/bukkit/event/block/SignChangeEvent.java --- a/src/main/java/org/bukkit/event/block/SignChangeEvent.java
+++ b/src/main/java/org/bukkit/event/block/SignChangeEvent.java +++ b/src/main/java/org/bukkit/event/block/SignChangeEvent.java
@@ -16,12 +16,25 @@ public class SignChangeEvent extends BlockEvent implements Cancellable { @@ -16,12 +16,25 @@ public class SignChangeEvent extends BlockEvent implements Cancellable {
@ -1485,7 +1497,7 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1268066e30ddb0cd3792ea4b3de894eb
+ // Paper start + // Paper start
+ this.adventure$lines = new java.util.ArrayList<>(); + this.adventure$lines = new java.util.ArrayList<>();
+ for (String theLine : theLines) { + for (String theLine : theLines) {
+ this.adventure$lines.add(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(theLine)); + this.adventure$lines.add(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(theLine));
+ } + }
+ // Paper end + // Paper end
} }
@ -1541,7 +1553,7 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1268066e30ddb0cd3792ea4b3de894eb
+ @Deprecated // Paper + @Deprecated // Paper
public String[] getLines() { public String[] getLines() {
- return lines; - return lines;
+ return adventure$lines.stream().map(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection()::serialize).toArray(String[]::new); // Paper + return adventure$lines.stream().map(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer()::serialize).toArray(String[]::new); // Paper
} }
/** /**
@ -1555,7 +1567,7 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1268066e30ddb0cd3792ea4b3de894eb
+ @Deprecated // Paper + @Deprecated // Paper
public String getLine(int index) throws IndexOutOfBoundsException { public String getLine(int index) throws IndexOutOfBoundsException {
- return lines[index]; - return lines[index];
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.adventure$lines.get(index)); // Paper + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.adventure$lines.get(index)); // Paper
} }
/** /**
@ -1568,12 +1580,12 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1268066e30ddb0cd3792ea4b3de894eb
+ @Deprecated // Paper + @Deprecated // Paper
public void setLine(int index, @Nullable String line) throws IndexOutOfBoundsException { public void setLine(int index, @Nullable String line) throws IndexOutOfBoundsException {
- lines[index] = line; - lines[index] = line;
+ adventure$lines.set(index, line != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(line) : null); // Paper + adventure$lines.set(index, line != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(line) : null); // Paper
} }
@Override @Override
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd75bc6e35 100644 index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..a01d4c21bedc7f1a54f5a330bb4c2909ce3a18e4 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -12,25 +12,48 @@ import org.jetbrains.annotations.Nullable; @@ -12,25 +12,48 @@ import org.jetbrains.annotations.Nullable;
@ -1621,7 +1633,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd
this.newTotalExp = newTotalExp; this.newTotalExp = newTotalExp;
this.newLevel = newLevel; this.newLevel = newLevel;
this.deathMessage = deathMessage; this.deathMessage = deathMessage;
+ this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper + this.adventure$deathMessage = deathMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper
} }
@NotNull @NotNull
@ -1659,7 +1671,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd
+ @Deprecated // Paper + @Deprecated // Paper
public void setDeathMessage(@Nullable String deathMessage) { public void setDeathMessage(@Nullable String deathMessage) {
this.deathMessage = deathMessage; this.deathMessage = deathMessage;
+ this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper + this.adventure$deathMessage = deathMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper
} }
/** /**
@ -1677,7 +1689,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd
- -
+ // Paper start //TODO: add translation API to drop String deathMessage in favor of just Adventure + // Paper start //TODO: add translation API to drop String deathMessage in favor of just Adventure
+ private static String getDeathMessageString(net.kyori.adventure.text.Component component) { + private static String getDeathMessageString(net.kyori.adventure.text.Component component) {
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(component); + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(component);
+ } + }
+ // Paper end + // Paper end
/** /**
@ -1739,7 +1751,7 @@ index 9c68c3f2d61500479f48b80264f625aaae2f3204..399afcd19fcb6acd24857ed6ab48cf0d
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private boolean cancel = false; private boolean cancel = false;
diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
index c8384da69af61e1970f254a3a9c206ee81d7a989..992d1025ca02020e87a9ab5db83d249427f41d69 100644 index c8384da69af61e1970f254a3a9c206ee81d7a989..d3b4219a57fff4519ef8d803c333c854fafa7859 100644
--- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java --- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
@ -1822,7 +1834,7 @@ index c8384da69af61e1970f254a3a9c206ee81d7a989..992d1025ca02020e87a9ab5db83d2494
+ @NotNull + @NotNull
+ @Deprecated // Paper + @Deprecated // Paper
+ public String getKickMessage() { + public String getKickMessage() {
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.message); // Paper + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper
+ } + }
+ +
+ /** + /**
@ -1833,7 +1845,7 @@ index c8384da69af61e1970f254a3a9c206ee81d7a989..992d1025ca02020e87a9ab5db83d2494
+ */ + */
+ @Deprecated // Paper + @Deprecated // Paper
+ public void setKickMessage(@NotNull final String message) { + public void setKickMessage(@NotNull final String message) {
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
+ } + }
+ +
/** /**
@ -1856,7 +1868,7 @@ index c8384da69af61e1970f254a3a9c206ee81d7a989..992d1025ca02020e87a9ab5db83d2494
public void disallow(@NotNull final Result result, @NotNull final String message) { public void disallow(@NotNull final Result result, @NotNull final String message) {
this.result = result; this.result = result;
- this.message = message; - this.message = message;
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
} }
/** /**
@ -1865,7 +1877,7 @@ index c8384da69af61e1970f254a3a9c206ee81d7a989..992d1025ca02020e87a9ab5db83d2494
public void disallow(@NotNull final PlayerPreLoginEvent.Result result, @NotNull final String message) { public void disallow(@NotNull final PlayerPreLoginEvent.Result result, @NotNull final String message) {
this.result = result == null ? null : Result.valueOf(result.name()); this.result = result == null ? null : Result.valueOf(result.name());
- this.message = message; - this.message = message;
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
} }
/** /**
@ -1895,7 +1907,7 @@ index 793b661b6d2d05de3d7f4fc26a4c018a2af58e62..f6d3b817de3001f04ea4554c7c39a129
player = who; player = who;
diff --git a/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java b/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java b/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java
index d06684aba7688ce06777dbd837a46856a9d7767f..4af1d064fcb57773dfa8f6ad40d6482973f8e1a8 100644 index d06684aba7688ce06777dbd837a46856a9d7767f..851a189d42e271679abc78f95049d8badf7a2b64 100644
--- a/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java
@@ -10,30 +10,60 @@ import org.jetbrains.annotations.Nullable; @@ -10,30 +10,60 @@ import org.jetbrains.annotations.Nullable;
@ -1913,7 +1925,7 @@ index d06684aba7688ce06777dbd837a46856a9d7767f..4af1d064fcb57773dfa8f6ad40d64829
+ @Deprecated // Paper end + @Deprecated // Paper end
public PlayerJoinEvent(@NotNull final Player playerJoined, @Nullable final String joinMessage) { public PlayerJoinEvent(@NotNull final Player playerJoined, @Nullable final String joinMessage) {
super(playerJoined); super(playerJoined);
+ this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : null; // Paper end + this.joinMessage = joinMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(joinMessage) : null; // Paper end
+ } + }
+ +
+ // Paper start + // Paper start
@ -1946,7 +1958,7 @@ index d06684aba7688ce06777dbd837a46856a9d7767f..4af1d064fcb57773dfa8f6ad40d64829
+ @Deprecated // Paper + @Deprecated // Paper
public String getJoinMessage() { public String getJoinMessage() {
- return joinMessage; - return joinMessage;
+ return this.joinMessage == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.joinMessage); // Paper + return this.joinMessage == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.joinMessage); // Paper
} }
/** /**
@ -1958,12 +1970,12 @@ index d06684aba7688ce06777dbd837a46856a9d7767f..4af1d064fcb57773dfa8f6ad40d64829
+ @Deprecated // Paper + @Deprecated // Paper
public void setJoinMessage(@Nullable String joinMessage) { public void setJoinMessage(@Nullable String joinMessage) {
- this.joinMessage = joinMessage; - this.joinMessage = joinMessage;
+ this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : null; // Paper + this.joinMessage = joinMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(joinMessage) : null; // Paper
} }
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
index 14c337f15fc804f52e52cb0a185aad38d89303a8..2b3f57d1a1c79923a2173f52d9cf61da1f75b7fc 100644 index 14c337f15fc804f52e52cb0a185aad38d89303a8..5c0efe74237dbe6803ce023fde99682ff70d1a92 100644
--- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java
@@ -10,35 +10,84 @@ import org.jetbrains.annotations.NotNull; @@ -10,35 +10,84 @@ import org.jetbrains.annotations.NotNull;
@ -1979,8 +1991,8 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..2b3f57d1a1c79923a2173f52d9cf61da
+ @Deprecated // Paper + @Deprecated // Paper
public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final String kickReason, @NotNull final String leaveMessage) { public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final String kickReason, @NotNull final String leaveMessage) {
+ super(playerKicked); + super(playerKicked);
+ this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper + this.kickReason = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickReason); // Paper
+ this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper + this.leaveMessage = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(leaveMessage); // Paper
+ this.cancel = false; + this.cancel = false;
+ } + }
+ // Paper start + // Paper start
@ -2038,7 +2050,7 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..2b3f57d1a1c79923a2173f52d9cf61da
+ @Deprecated // Paper + @Deprecated // Paper
public String getReason() { public String getReason() {
- return kickReason; - return kickReason;
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.kickReason); // Paper + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.kickReason); // Paper
} }
/** /**
@ -2051,7 +2063,7 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..2b3f57d1a1c79923a2173f52d9cf61da
+ @Deprecated // Paper + @Deprecated // Paper
public String getLeaveMessage() { public String getLeaveMessage() {
- return leaveMessage; - return leaveMessage;
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.leaveMessage); // Paper + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.leaveMessage); // Paper
} }
@Override @Override
@ -2064,7 +2076,7 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..2b3f57d1a1c79923a2173f52d9cf61da
+ @Deprecated // Paper + @Deprecated // Paper
public void setReason(@NotNull String kickReason) { public void setReason(@NotNull String kickReason) {
- this.kickReason = kickReason; - this.kickReason = kickReason;
+ this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper + this.kickReason = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickReason); // Paper
} }
/** /**
@ -2076,7 +2088,7 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..2b3f57d1a1c79923a2173f52d9cf61da
+ @Deprecated // Paper + @Deprecated // Paper
public void setLeaveMessage(@NotNull String leaveMessage) { public void setLeaveMessage(@NotNull String leaveMessage) {
- this.leaveMessage = leaveMessage; - this.leaveMessage = leaveMessage;
+ this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper + this.leaveMessage = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(leaveMessage); // Paper
} }
@NotNull @NotNull
@ -2118,7 +2130,7 @@ index 1db386bb701cb6974daedc6bb5b93a3afbc42100..84521186404b8e43c81a2f9513dce2be
return locale; return locale;
} }
diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..95c53d934f928d25f7b20cfbf2e5faa3df31ddc4 100644 index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..75cc54739ef841cd90568d74927d6002d4cfa7e0 100644
--- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
@@ -17,7 +17,7 @@ public class PlayerLoginEvent extends PlayerEvent { @@ -17,7 +17,7 @@ public class PlayerLoginEvent extends PlayerEvent {
@ -2140,7 +2152,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..95c53d934f928d25f7b20cfbf2e5faa3
public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) { // Spigot public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) { // Spigot
this(player, hostname, address, realAddress); // Spigot this(player, hostname, address, realAddress); // Spigot
this.result = result; this.result = result;
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
+ } + }
+ +
+ // Paper start + // Paper start
@ -2193,7 +2205,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..95c53d934f928d25f7b20cfbf2e5faa3
+ @Deprecated // Paper + @Deprecated // Paper
public String getKickMessage() { public String getKickMessage() {
- return message; - return message;
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.message); // Paper + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper
} }
/** /**
@ -2205,7 +2217,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..95c53d934f928d25f7b20cfbf2e5faa3
+ @Deprecated // Paper + @Deprecated // Paper
public void setKickMessage(@NotNull final String message) { public void setKickMessage(@NotNull final String message) {
- this.message = message; - this.message = message;
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
} }
/** /**
@ -2227,7 +2239,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..95c53d934f928d25f7b20cfbf2e5faa3
+ @Deprecated // Paper start + @Deprecated // Paper start
public void disallow(@NotNull final Result result, @NotNull final String message) { public void disallow(@NotNull final Result result, @NotNull final String message) {
+ this.result = result; + this.result = result;
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message);
+ } + }
+ /** + /**
+ * Disallows the player from logging in, with the given reason + * Disallows the player from logging in, with the given reason
@ -2241,7 +2253,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..95c53d934f928d25f7b20cfbf2e5faa3
this.message = message; this.message = message;
} }
diff --git a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
index fb066251f793ec3b41bfc075b9478901b15ee549..6800132c6288b4588fd02b08d26f016c38f27129 100644 index fb066251f793ec3b41bfc075b9478901b15ee549..123979ed64939d615b061f91c19c630e1e1db8c7 100644
--- a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java
@@ -19,7 +19,7 @@ import org.jetbrains.annotations.NotNull; @@ -19,7 +19,7 @@ import org.jetbrains.annotations.NotNull;
@ -2309,7 +2321,7 @@ index fb066251f793ec3b41bfc075b9478901b15ee549..6800132c6288b4588fd02b08d26f016c
+ @Deprecated // Paper + @Deprecated // Paper
+ @NotNull + @NotNull
+ public String getKickMessage() { + public String getKickMessage() {
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.message); // Paper + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper
+ } + }
+ +
+ /** + /**
@ -2320,7 +2332,7 @@ index fb066251f793ec3b41bfc075b9478901b15ee549..6800132c6288b4588fd02b08d26f016c
+ */ + */
+ @Deprecated // Paper + @Deprecated // Paper
+ public void setKickMessage(@NotNull final String message) { + public void setKickMessage(@NotNull final String message) {
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
+ } + }
+ +
/** /**
@ -2343,12 +2355,12 @@ index fb066251f793ec3b41bfc075b9478901b15ee549..6800132c6288b4588fd02b08d26f016c
public void disallow(@NotNull final Result result, @NotNull final String message) { public void disallow(@NotNull final Result result, @NotNull final String message) {
this.result = result; this.result = result;
- this.message = message; - this.message = message;
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
} }
/** /**
diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
index d70c25f404e994766a9ebce89a917c8d0719777c..0395ca85a466f6356259078d3bad48b2ce6e57b7 100644 index d70c25f404e994766a9ebce89a917c8d0719777c..849e8f10dd77e9fb46aab17752b8f1ff79e9d42e 100644
--- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
@@ -10,30 +10,59 @@ import org.jetbrains.annotations.Nullable; @@ -10,30 +10,59 @@ import org.jetbrains.annotations.Nullable;
@ -2361,7 +2373,7 @@ index d70c25f404e994766a9ebce89a917c8d0719777c..0395ca85a466f6356259078d3bad48b2
+ @Deprecated // Paper + @Deprecated // Paper
public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) { public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) {
super(who); super(who);
+ this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper + this.quitMessage = quitMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(quitMessage) : null; // Paper
+ } + }
+ // Paper start + // Paper start
+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) { + public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) {
@ -2398,7 +2410,7 @@ index d70c25f404e994766a9ebce89a917c8d0719777c..0395ca85a466f6356259078d3bad48b2
+ @Deprecated // Paper + @Deprecated // Paper
public String getQuitMessage() { public String getQuitMessage() {
- return quitMessage; - return quitMessage;
+ return this.quitMessage == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.quitMessage); // Paper + return this.quitMessage == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.quitMessage); // Paper
} }
/** /**
@ -2410,12 +2422,12 @@ index d70c25f404e994766a9ebce89a917c8d0719777c..0395ca85a466f6356259078d3bad48b2
+ @Deprecated // Paper + @Deprecated // Paper
public void setQuitMessage(@Nullable String quitMessage) { public void setQuitMessage(@Nullable String quitMessage) {
- this.quitMessage = quitMessage; - this.quitMessage = quitMessage;
+ this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper + this.quitMessage = quitMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(quitMessage) : null; // Paper
} }
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java diff --git a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java
index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..943d324435350d3f16fad3e21cb472a01a3ff60b 100644 index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..4f8c85222c7bd33217c7db0ff5f47bf397f8f3e5 100644
--- a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java --- a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java
+++ b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java +++ b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull; @@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
@ -2435,7 +2447,7 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..943d324435350d3f16fad3e21cb472a0
public BroadcastMessageEvent(boolean isAsync, @NotNull String message, @NotNull Set<CommandSender> recipients) { public BroadcastMessageEvent(boolean isAsync, @NotNull String message, @NotNull Set<CommandSender> recipients) {
+ // Paper start + // Paper start
+ super(isAsync); + super(isAsync);
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message);
+ this.recipients = recipients; + this.recipients = recipients;
+ } + }
+ +
@ -2480,7 +2492,7 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..943d324435350d3f16fad3e21cb472a0
+ @Deprecated // Paper + @Deprecated // Paper
public String getMessage() { public String getMessage() {
- return message; - return message;
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.message); // Paper + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper
} }
/** /**
@ -2492,19 +2504,15 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..943d324435350d3f16fad3e21cb472a0
+ @Deprecated // Paper + @Deprecated // Paper
public void setMessage(@NotNull String message) { public void setMessage(@NotNull String message) {
- this.message = message; - this.message = message;
+ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper
} }
/** /**
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index 7a2a58bac8e721c3f0c64f69f77be07a51f76d58..29c5bd1f522310def76bf7b46a5b61463d53ff96 100644 index 7a2a58bac8e721c3f0c64f69f77be07a51f76d58..ede5a41bc071a9c9cea369b227b37a50222f295d 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java --- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java +++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -14,18 +14,20 @@ import org.jetbrains.annotations.NotNull; @@ -17,15 +17,16 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* checked and removed by {@link #iterator() iterating} over this event.
*/
public class ServerListPingEvent extends ServerEvent implements Iterable<Player> {
+ private static final net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer LEGACY_SECTION_SERIALIZER = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.builder().useUnusualXRepeatedCharacterHexFormat().build(); // Paper
private static final int MAGIC_PLAYER_COUNT = Integer.MIN_VALUE; private static final int MAGIC_PLAYER_COUNT = Integer.MIN_VALUE;
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private final InetAddress address; private final InetAddress address;
@ -2519,11 +2527,11 @@ index 7a2a58bac8e721c3f0c64f69f77be07a51f76d58..29c5bd1f522310def76bf7b46a5b6146
Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers); Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
this.address = address; this.address = address;
- this.motd = motd; - this.motd = motd;
+ this.motd = LEGACY_SECTION_SERIALIZER.deserialize(motd); // Paper + this.motd = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(motd); // Paper
this.numPlayers = numPlayers; this.numPlayers = numPlayers;
this.maxPlayers = maxPlayers; this.maxPlayers = maxPlayers;
} }
@@ -38,14 +40,58 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player> @@ -38,14 +39,58 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param address the address of the pinger * @param address the address of the pinger
* @param motd the message of the day * @param motd the message of the day
* @param maxPlayers the max number of players * @param maxPlayers the max number of players
@ -2534,7 +2542,7 @@ index 7a2a58bac8e721c3f0c64f69f77be07a51f76d58..29c5bd1f522310def76bf7b46a5b6146
+ super(true); + super(true);
+ this.numPlayers = MAGIC_PLAYER_COUNT; + this.numPlayers = MAGIC_PLAYER_COUNT;
+ this.address = address; + this.address = address;
+ this.motd = LEGACY_SECTION_SERIALIZER.deserialize(motd); // Paper + this.motd = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(motd); // Paper
+ this.maxPlayers = maxPlayers; + this.maxPlayers = maxPlayers;
+ } + }
+ // Paper start + // Paper start
@ -2582,7 +2590,7 @@ index 7a2a58bac8e721c3f0c64f69f77be07a51f76d58..29c5bd1f522310def76bf7b46a5b6146
/** /**
* Get the address the ping is coming from. * Get the address the ping is coming from.
@@ -61,19 +107,23 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player> @@ -61,19 +106,23 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* Get the message of the day message. * Get the message of the day message.
* *
* @return the message of the day * @return the message of the day
@ -2592,7 +2600,7 @@ index 7a2a58bac8e721c3f0c64f69f77be07a51f76d58..29c5bd1f522310def76bf7b46a5b6146
+ @Deprecated // Paper + @Deprecated // Paper
public String getMotd() { public String getMotd() {
- return motd; - return motd;
+ return LEGACY_SECTION_SERIALIZER.serialize(this.motd); // Paper + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.motd); // Paper
} }
/** /**
@ -2604,12 +2612,12 @@ index 7a2a58bac8e721c3f0c64f69f77be07a51f76d58..29c5bd1f522310def76bf7b46a5b6146
+ @Deprecated // Paper + @Deprecated // Paper
public void setMotd(@NotNull String motd) { public void setMotd(@NotNull String motd) {
- this.motd = motd; - this.motd = motd;
+ this.motd = LEGACY_SECTION_SERIALIZER.deserialize(motd); // Paper + this.motd = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(motd); // Paper
} }
/** /**
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
index 14346d83bc99581b18e53d19af03708c0bf22cf7..a4e3d526db2d17dc923cbe82e53d3c902d61e1f3 100644 index 14346d83bc99581b18e53d19af03708c0bf22cf7..664de64b020cf9090a2fbee0afe2bfaf150adc3c 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java --- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -446,11 +446,25 @@ public abstract class InventoryView { @@ -446,11 +446,25 @@ public abstract class InventoryView {
@ -2624,7 +2632,7 @@ index 14346d83bc99581b18e53d19af03708c0bf22cf7..a4e3d526db2d17dc923cbe82e53d3c90
*/ */
@NotNull @NotNull
+ public /*abstract*/ net.kyori.adventure.text.Component title() { + public /*abstract*/ net.kyori.adventure.text.Component title() {
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.getTitle()); + return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(this.getTitle());
+ } + }
+ // Paper end + // Paper end
+ +
@ -3027,7 +3035,7 @@ index f2e9f2753ec92aa4a3e3f06ca6053bd70b9091d7..1c362636c56db0e6c118171ba367c43c
/** /**
diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java
index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ca763b231749f108b6773040a5c6109378b21b31 100644 index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ed0bc2024a0bb85837e25f75ae89d1fe257b2e60 100644
--- a/src/main/java/org/bukkit/map/MapCursor.java --- a/src/main/java/org/bukkit/map/MapCursor.java
+++ b/src/main/java/org/bukkit/map/MapCursor.java +++ b/src/main/java/org/bukkit/map/MapCursor.java
@@ -10,7 +10,7 @@ public final class MapCursor { @@ -10,7 +10,7 @@ public final class MapCursor {
@ -3071,7 +3079,7 @@ index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ca763b231749f108b6773040a5c61093
setRawType(type); setRawType(type);
this.visible = visible; this.visible = visible;
- this.caption = caption; - this.caption = caption;
+ this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper + this.caption = caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(caption); // Paper
} }
+ // Paper start + // Paper start
+ /** + /**
@ -3115,7 +3123,7 @@ index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ca763b231749f108b6773040a5c61093
setType(type); setType(type);
this.visible = visible; this.visible = visible;
- this.caption = caption; - this.caption = caption;
+ this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper + this.caption = caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(caption); // Paper
} }
/** /**
@ -3151,7 +3159,7 @@ index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ca763b231749f108b6773040a5c61093
+ @Deprecated // Paper + @Deprecated // Paper
public String getCaption() { public String getCaption() {
- return caption; - return caption;
+ return this.caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.caption); // Paper + return this.caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.caption); // Paper
} }
/** /**
@ -3163,7 +3171,7 @@ index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ca763b231749f108b6773040a5c61093
+ @Deprecated // Paper + @Deprecated // Paper
public void setCaption(@Nullable String caption) { public void setCaption(@Nullable String caption) {
- this.caption = caption; - this.caption = caption;
+ this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper + this.caption = caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(caption); // Paper
} }
/** /**

View File

@ -55,10 +55,10 @@ index 0000000000000000000000000000000000000000..2a2651299e8dc631938ba4b4078dc694
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..1b6d737046646c102b0d519ab3f67c3fbd503979 100644 index dd0b80c268644ac714311501215f45166092b856..bed84606a111648ce39c2e6683c0ca5a2138592f 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -77,5 +77,12 @@ public interface UnsafeValues { @@ -78,5 +78,12 @@ public interface UnsafeValues {
* @return name * @return name
*/ */
String getTimingsServerName(); String getTimingsServerName();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add BaseComponent sendMessage methods to CommandSender
diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java
index 2588edf75483855e0c843834f39ca371770730b9..6aa795fe79ceca03c1725c36f2b0d3a63acd134e 100644 index c88418c7aa19b4fecdfa9af3d18ff202a5dc5763..fb0e608fa92dae99b9eee8fc1cbdf4b91a33e620 100644
--- a/src/main/java/org/bukkit/command/CommandSender.java --- a/src/main/java/org/bukkit/command/CommandSender.java
+++ b/src/main/java/org/bukkit/command/CommandSender.java +++ b/src/main/java/org/bukkit/command/CommandSender.java
@@ -1,6 +1,9 @@ @@ -1,6 +1,9 @@
@ -20,7 +20,7 @@ index 2588edf75483855e0c843834f39ca371770730b9..6aa795fe79ceca03c1725c36f2b0d3a6
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -117,5 +120,33 @@ public interface CommandSender extends net.kyori.adventure.audience.Audience, Pe @@ -117,5 +120,33 @@ public interface CommandSender extends net.kyori.adventure.audience.Audience, Pe
default void sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { default void sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) {
this.sendMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message)); this.sendMessage(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(message));
} }
+ +
+ /** + /**

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..2f9412e0ba177f1e23befd64681a4a5a1994563d index 0000000000000000000000000000000000000000..a077962fa786a3291849abfa823c7f0ec4664fce
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java
@@ -0,0 +1,277 @@ @@ -0,0 +1,277 @@
@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..2f9412e0ba177f1e23befd64681a4a5a
+ +
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import org.apache.commons.lang.Validate; +import org.apache.commons.lang.Validate;
+import org.bukkit.Bukkit;
+import org.bukkit.event.Cancellable; +import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event; +import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList; +import org.bukkit.event.HandlerList;
@ -262,7 +262,7 @@ index 0000000000000000000000000000000000000000..2f9412e0ba177f1e23befd64681a4a5a
+ @NotNull + @NotNull
+ @Deprecated + @Deprecated
+ public String getFailMessage() { + public String getFailMessage() {
+ return LegacyComponentSerializer.legacySection().serialize(this.failMessage()); + return Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.failMessage());
+ } + }
+ +
+ /** + /**
@ -274,7 +274,7 @@ index 0000000000000000000000000000000000000000..2f9412e0ba177f1e23befd64681a4a5a
+ @Deprecated + @Deprecated
+ public void setFailMessage(@NotNull String failMessage) { + public void setFailMessage(@NotNull String failMessage) {
+ Validate.notEmpty(failMessage, "fail message cannot be null or empty"); + Validate.notEmpty(failMessage, "fail message cannot be null or empty");
+ this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage)); + this.failMessage(Bukkit.getUnsafe().legacyComponentSerializer().deserialize(failMessage));
+ } + }
+ +
+ @NotNull + @NotNull

View File

@ -6,14 +6,14 @@ Subject: [PATCH] Add UnknownCommandEvent
diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..4643b7e640e5c1b53de8ee575b3a760fa9b1d2e8 index 0000000000000000000000000000000000000000..d5632d352590dec6982a372b285a8d4a332fa589
--- /dev/null --- /dev/null
+++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java +++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java
@@ -0,0 +1,114 @@ @@ -0,0 +1,114 @@
+package org.bukkit.event.command; +package org.bukkit.event.command;
+ +
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import org.bukkit.Bukkit;
+import org.bukkit.command.CommandSender; +import org.bukkit.command.CommandSender;
+import org.bukkit.event.HandlerList; +import org.bukkit.event.HandlerList;
+import org.bukkit.event.Event; +import org.bukkit.event.Event;
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..4643b7e640e5c1b53de8ee575b3a760f
+ +
+ @Deprecated + @Deprecated
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) { + public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) {
+ this(sender, commandLine, message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message)); + this(sender, commandLine, message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message));
+ } + }
+ +
+ public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) { + public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) {
@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..4643b7e640e5c1b53de8ee575b3a760f
+ @Nullable + @Nullable
+ @Deprecated + @Deprecated
+ public String getMessage() { + public String getMessage() {
+ return this.message == null ? null : LegacyComponentSerializer.legacySection().serialize(this.message); + return this.message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message);
+ } + }
+ +
+ /** + /**
@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..4643b7e640e5c1b53de8ee575b3a760f
+ */ + */
+ @Deprecated + @Deprecated
+ public void setMessage(@Nullable String message) { + public void setMessage(@Nullable String message) {
+ this.message(message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message)); + this.message(message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message));
+ } + }
+ +
+ /** + /**

View File

@ -9,7 +9,7 @@ Allows you to do dynamic whitelisting and change of kick message
diff --git a/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java diff --git a/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568a25793fa index 0000000000000000000000000000000000000000..8a259ab49ea79673b6da9e4e2aaecec67469994e
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java +++ b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java
@@ -0,0 +1,142 @@ @@ -0,0 +1,142 @@
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
+ +
+import com.destroystokyo.paper.profile.PlayerProfile; +import com.destroystokyo.paper.profile.PlayerProfile;
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import org.bukkit.Bukkit;
+import org.bukkit.event.Event; +import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList; +import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull;
@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
+ +
+ @Deprecated + @Deprecated
+ public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable String kickMessage) { + public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable String kickMessage) {
+ this(profile, whitelistEnabled, whitelisted, isOp, kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage)); + this(profile, whitelistEnabled, whitelisted, isOp, kickMessage == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickMessage));
+ } + }
+ +
+ public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable Component kickMessage) { + public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable Component kickMessage) {
@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
+ @Deprecated + @Deprecated
+ @Nullable + @Nullable
+ public String getKickMessage() { + public String getKickMessage() {
+ return this.kickMessage == null ? null : LegacyComponentSerializer.legacySection().serialize(kickMessage); + return this.kickMessage == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().serialize(kickMessage);
+ } + }
+ +
+ /** + /**
@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568
+ */ + */
+ @Deprecated + @Deprecated
+ public void setKickMessage(@Nullable String kickMessage) { + public void setKickMessage(@Nullable String kickMessage) {
+ this.kickMessage(kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage)); + this.kickMessage(kickMessage == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickMessage));
+ } + }
+ +
+ /** + /**

View File

@ -7,10 +7,10 @@ Not here to name and shame, only so server admins can be aware of which
plugins have and haven't been updated. plugins have and haven't been updated.
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 1b6d737046646c102b0d519ab3f67c3fbd503979..541e28a9bece0beb0c2cf02c39030840b758c6e6 100644 index bed84606a111648ce39c2e6683c0ca5a2138592f..3aacc3103698144b343facdd7f4a35fbdb62e241 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -84,5 +84,11 @@ public interface UnsafeValues { @@ -85,5 +85,11 @@ public interface UnsafeValues {
default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher(); return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
} }

View File

@ -8,7 +8,7 @@ Exposes a mutable array on items a player should keep on death
Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index 17deccb858990b09bcb5a063a179e40f1ffc99d1..831c2aeca95f813b675603af8173e2a20b740052 100644 index a01d4c21bedc7f1a54f5a330bb4c2909ce3a18e4..8c46eaebf004823c1c31eb2c7304181487cb1332 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -36,7 +36,6 @@ public class PlayerDeathEvent extends EntityDeathEvent { @@ -36,7 +36,6 @@ public class PlayerDeathEvent extends EntityDeathEvent {
@ -20,7 +20,7 @@ index 17deccb858990b09bcb5a063a179e40f1ffc99d1..831c2aeca95f813b675603af8173e2a2
this(player, drops, droppedExp, 0, deathMessage); this(player, drops, droppedExp, 0, deathMessage);
} }
@@ -56,6 +55,41 @@ public class PlayerDeathEvent extends EntityDeathEvent { @@ -56,6 +55,41 @@ public class PlayerDeathEvent extends EntityDeathEvent {
this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper this.adventure$deathMessage = deathMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper
} }
+ @Deprecated // Paper + @Deprecated // Paper

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format. Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 541e28a9bece0beb0c2cf02c39030840b758c6e6..d3ec5084e33dff038d54cdd2aeb703a3eb25f7a7 100644 index 3aacc3103698144b343facdd7f4a35fbdb62e241..b824a1b0590014d428e64f789008454bd241996a 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -90,5 +90,9 @@ public interface UnsafeValues { @@ -91,5 +91,9 @@ public interface UnsafeValues {
static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) { static boolean isLegacyPlugin(org.bukkit.plugin.Plugin plugin) {
return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion()); return !Bukkit.getUnsafe().isSupportedApiVersion(plugin.getDescription().getAPIVersion());
} }
@ -20,7 +20,7 @@ index 541e28a9bece0beb0c2cf02c39030840b758c6e6..d3ec5084e33dff038d54cdd2aeb703a3
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 699aa48312f2183f7d11655fe59e12d51d148afe..7531fc910ed65dc12e242cf5042ce4cef9fe661d 100644 index b26b9344a7d226a0d81d133fd7bfcfb36d8a742b..878f09d5e587bc4bd70443fbdb89dac29e5a538d 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -619,6 +619,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor @@ -619,6 +619,30 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor

View File

@ -27,10 +27,10 @@ index 2e959d195f7a5e723952e421aeaeeb463f07d3f5..2a3becabbd10fa8ffd19f35a3f6d8a6b
/** /**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index d3ec5084e33dff038d54cdd2aeb703a3eb25f7a7..ac43afbf6230a481ab8cffbb3bc91b716316c00d 100644 index b824a1b0590014d428e64f789008454bd241996a..23d0798d479fc3dd9cc4c41f7999a889987b9ab0 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -94,5 +94,27 @@ public interface UnsafeValues { @@ -95,5 +95,27 @@ public interface UnsafeValues {
byte[] serializeItem(ItemStack item); byte[] serializeItem(ItemStack item);
ItemStack deserializeItem(byte[] data); ItemStack deserializeItem(byte[] data);

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index ac43afbf6230a481ab8cffbb3bc91b716316c00d..931ffa38faab86445a5d63364a47cb653ca3d4ed 100644 index 23d0798d479fc3dd9cc4c41f7999a889987b9ab0..f486d7c819f6330223980793c9b086fded0af059 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -116,5 +116,13 @@ public interface UnsafeValues { @@ -117,5 +117,13 @@ public interface UnsafeValues {
* @return the translation key * @return the translation key
*/ */
String getTranslationKey(org.bukkit.entity.EntityType type); String getTranslationKey(org.bukkit.entity.EntityType type);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add API for quit reason
diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
index 0395ca85a466f6356259078d3bad48b2ce6e57b7..6e9205024ca9d3000a371bd0eb723dcd6c662bce 100644 index 849e8f10dd77e9fb46aab17752b8f1ff79e9d42e..b6016aa1e91863efc252eecab69ade6f54c89f27 100644
--- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java --- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java
@@ -11,16 +11,28 @@ import org.jetbrains.annotations.Nullable; @@ -11,16 +11,28 @@ import org.jetbrains.annotations.Nullable;
@ -22,7 +22,7 @@ index 0395ca85a466f6356259078d3bad48b2ce6e57b7..6e9205024ca9d3000a371bd0eb723dcd
+ @Deprecated // Paper + @Deprecated // Paper
+ public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) { + public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) {
super(who); super(who);
this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper this.quitMessage = quitMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(quitMessage) : null; // Paper
+ this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason; + this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason;
} }
// Paper start // Paper start

View File

@ -3116,3 +3116,21 @@ index 1582a799e456402453c43c2e0c6b8a194951a9dd..0dfb9ddad426e962db1216d1f490c1c5
StringBuilder out = new StringBuilder(); StringBuilder out = new StringBuilder();
boolean hadFormat = false; boolean hadFormat = false;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index d63a160f1b00de8d67ae1eb4fefbd5ca06835de7..47370fc3a623a38fbd24dfe484db065a64d44204 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -59,6 +59,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
private CraftMagicNumbers() {}
+ // Paper start
+ @Override
+ public net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer() {
+ return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC;
+ }
+ // Paper end
+
public static IBlockData getBlock(MaterialData material) {
return getBlock(material.getItemType(), material.getData());
}

View File

@ -126,10 +126,10 @@ index 0000000000000000000000000000000000000000..5deed3e25ff41ab0a4015a5fd0c1e952
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index d63a160f1b00de8d67ae1eb4fefbd5ca06835de7..8a4ee9e4762141b05c0e79f387823414102e6382 100644 index 47370fc3a623a38fbd24dfe484db065a64d44204..83d056f2696498ec6e5d12a1602f8fcb833734c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -343,6 +343,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -350,6 +350,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getTimingsServerName() { public String getTimingsServerName() {
return com.destroystokyo.paper.PaperConfig.timingsServerName; return com.destroystokyo.paper.PaperConfig.timingsServerName;
} }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add CraftMagicNumbers.isSupportedApiVersion()
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 8a4ee9e4762141b05c0e79f387823414102e6382..81fd82de0bdb5314096ba25c2c0b3292971662b3 100644 index 83d056f2696498ec6e5d12a1602f8fcb833734c0..e60ee5f6bd990ce89a130a85b6821c5b7f346ae8 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -348,6 +348,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -355,6 +355,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.PaperVersionFetcher(); return new com.destroystokyo.paper.PaperVersionFetcher();
} }

View File

@ -50,10 +50,10 @@ index 6e6cabc03bc3822ee973bdafef8f4adb61b6c263..0282dcb68fa185b342f59c5aaafe8f42
DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream))); DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream)));
Throwable throwable = null; Throwable throwable = null;
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 81fd82de0bdb5314096ba25c2c0b3292971662b3..324afd2a5e50a3b1fd9de926f6da8836b00e173b 100644 index e60ee5f6bd990ce89a130a85b6821c5b7f346ae8..cb95d6f29ecedae0c901fe202fdd7c1d1c1bf4e1 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -353,6 +353,46 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -360,6 +360,46 @@ public final class CraftMagicNumbers implements UnsafeValues {
public boolean isSupportedApiVersion(String apiVersion) { public boolean isSupportedApiVersion(String apiVersion) {
return apiVersion != null && SUPPORTED_API.contains(apiVersion); return apiVersion != null && SUPPORTED_API.contains(apiVersion);
} }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add a way to get translation keys for blocks, entities and
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index a45ceff9ff970b996b2767379a2ecd4693f52d3a..4b4f14711d483089a5d5478b57539911a9c7a2fc 100644 index 5b35100d9d44f0ae5d547fdad85de9e5ee73f5b5..431e362138f4e186b3f6092137f8f36e9615801f 100644
--- a/src/main/java/net/minecraft/server/Block.java --- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java
@@ -279,6 +279,7 @@ public class Block extends BlockBase implements IMaterial { @@ -279,6 +279,7 @@ public class Block extends BlockBase implements IMaterial {
@ -74,7 +74,7 @@ index f787238575ed7ac9108a2fd9782af55056219767..3524b677525bf2bb529b797fe1f258ef
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 324afd2a5e50a3b1fd9de926f6da8836b00e173b..8f13e2685b8e68005d2c4d1613089f4d606fba94 100644 index cb95d6f29ecedae0c901fe202fdd7c1d1c1bf4e1..6cc747445e07920bce1424238674ddc2b51e7905 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -45,6 +45,7 @@ import org.bukkit.Registry; @@ -45,6 +45,7 @@ import org.bukkit.Registry;
@ -85,7 +85,7 @@ index 324afd2a5e50a3b1fd9de926f6da8836b00e173b..8f13e2685b8e68005d2c4d1613089f4d
import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.legacy.CraftLegacy; import org.bukkit.craftbukkit.legacy.CraftLegacy;
@@ -393,6 +394,25 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -400,6 +401,25 @@ public final class CraftMagicNumbers implements UnsafeValues {
throw new RuntimeException(); throw new RuntimeException();
} }
} }

View File

@ -21,10 +21,10 @@ index a7b225249f7ffafa2c6e1fc60657067229e02960..fcb5cf78d1deff3c2593c7470f5501be
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 8f13e2685b8e68005d2c4d1613089f4d606fba94..f37ab6dc33cda2aeb997db060b255acda3316b61 100644 index 6cc747445e07920bce1424238674ddc2b51e7905..6be34896149366925edd9d7eb4630132533d60c2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -413,6 +413,10 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -420,6 +420,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
return net.minecraft.server.EntityTypes.getByName(type.getName()).map(net.minecraft.server.EntityTypes::getDescriptionId).orElse(null); return net.minecraft.server.EntityTypes.getByName(type.getName()).map(net.minecraft.server.EntityTypes::getDescriptionId).orElse(null);
} }

View File

@ -35,10 +35,10 @@ index 17789407b9e86896a963a305a13357286aa5f319..c680319e4040be2b60795b22a5e65d64
if (this.m || !this.i.isEmpty() || !this.j.isEmpty()) { if (this.m || !this.i.isEmpty() || !this.j.isEmpty()) {
Map<MinecraftKey, AdvancementProgress> map = Maps.newHashMap(); Map<MinecraftKey, AdvancementProgress> map = Maps.newHashMap();
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index e073db219a35c3ac02e4c5f65a9ad405cd148d1d..979f3504e6a6ca46993f3d9b0f408ab6744bdccd 100644 index 6be34896149366925edd9d7eb4630132533d60c2..db241142e892940571c39e95f2dce648e79702bb 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -282,7 +282,13 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -289,7 +289,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex); Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
} }

View File

@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..4a689a2769ac343c2ffab49631c41601
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b1e7494fe57cfd93a57b7cee62db692c599619ce..f4263b7a787a3b60d20d63aec3fd42658ca4af38 100644 index c1c087cf9a3addef41d9dbec76f23177176dd44f..db0f0550ea011ff8222473de9940e4bfdc7b9e06 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2216,6 +2216,11 @@ public final class CraftServer implements Server { @@ -2216,6 +2216,11 @@ public final class CraftServer implements Server {
@ -57,10 +57,10 @@ index b1e7494fe57cfd93a57b7cee62db692c599619ce..f4263b7a787a3b60d20d63aec3fd4265
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 979f3504e6a6ca46993f3d9b0f408ab6744bdccd..ac5003dc827217bd1947c71044abcbcbd2210dcd 100644 index db241142e892940571c39e95f2dce648e79702bb..00e53d577b1dcaccb409e62d35165ee015de9330 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -91,8 +91,17 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -98,8 +98,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
private static final Map<Material, Item> MATERIAL_ITEM = new HashMap<>(); private static final Map<Material, Item> MATERIAL_ITEM = new HashMap<>();
private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>(); private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>();
private static final Map<Material, FluidType> MATERIAL_FLUID = new HashMap<>(); private static final Map<Material, FluidType> MATERIAL_FLUID = new HashMap<>();
@ -78,7 +78,7 @@ index 979f3504e6a6ca46993f3d9b0f408ab6744bdccd..ac5003dc827217bd1947c71044abcbcb
for (Block block : IRegistry.BLOCK) { for (Block block : IRegistry.BLOCK) {
BLOCK_MATERIAL.put(block, Material.getMaterial(IRegistry.BLOCK.getKey(block).getKey().toUpperCase(Locale.ROOT))); BLOCK_MATERIAL.put(block, Material.getMaterial(IRegistry.BLOCK.getKey(block).getKey().toUpperCase(Locale.ROOT)));
} }
@@ -158,6 +167,14 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -165,6 +174,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
public static MinecraftKey key(Material mat) { public static MinecraftKey key(Material mat) {
return CraftNamespacedKey.toMinecraft(mat.getKey()); return CraftNamespacedKey.toMinecraft(mat.getKey());
} }