From 7df3240f800e7681bc3555555fe1c2261a6b36c5 Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Thu, 5 Aug 2021 21:53:50 +0200 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: e0598aa2 SPIGOT-6692: Add sendSignChange overload with a hasGlowingText parameter CraftBukkit Changes: 2cdc6b1e4 SPIGOT-6692: Add sendSignChange overload with a hasGlowingText parameter --- .../api/Add-Player-Client-Options-API.patch | 2 +- .../api/Add-String-based-Action-Bar-API.patch | 4 +- patches/api/Adventure.patch | 91 ++++++++++++++++--- patches/api/Expose-Tracked-Players.patch | 4 +- .../api/Player-Tab-List-and-Title-APIs.patch | 2 +- patches/api/Player.setPlayerProfile-API.patch | 2 +- patches/server/Adventure.patch | 26 +++--- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 9 files changed, 100 insertions(+), 35 deletions(-) diff --git a/patches/api/Add-Player-Client-Options-API.patch b/patches/api/Add-Player-Client-Options-API.patch index e1a66a70d..c579c4940 100644 --- a/patches/api/Add-Player-Client-Options-API.patch +++ b/patches/api/Add-Player-Client-Options-API.patch @@ -180,8 +180,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ package org.bukkit.entity; - import java.net.InetSocketAddress; + import java.util.List; // Paper import java.util.UUID; +import com.destroystokyo.paper.ClientOption; // Paper import com.destroystokyo.paper.Title; // Paper diff --git a/patches/api/Add-String-based-Action-Bar-API.patch b/patches/api/Add-String-based-Action-Bar-API.patch index 40c557dab..23823244f 100644 --- a/patches/api/Add-String-based-Action-Bar-API.patch +++ b/patches/api/Add-String-based-Action-Bar-API.patch @@ -8,8 +8,8 @@ diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/buk index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ package org.bukkit.entity; - import java.net.InetSocketAddress; +@@ -0,0 +0,0 @@ import java.net.InetSocketAddress; + import java.util.List; // Paper import java.util.UUID; import com.destroystokyo.paper.Title; // Paper +import net.kyori.adventure.text.Component; diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index abfcdcfa8..245644598 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -1355,6 +1355,14 @@ diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/buk index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java +@@ -0,0 +0,0 @@ + package org.bukkit.entity; + + import java.net.InetSocketAddress; ++import java.util.List; // Paper + import java.util.UUID; + import org.bukkit.DyeColor; + import org.bukkit.Effect; @@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable; /** * Represents a player, connected or not @@ -1530,14 +1538,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean sendChunkChange(@NotNull Location loc, int sx, int sy, int sz, @NotNull byte[] data); + // Paper start - /** - * Send a sign change. This fakes a sign change packet for a user at - * a certain location. This will not actually change the world in any way. -@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM - * @throws IllegalArgumentException if location is null - * @throws IllegalArgumentException if lines is non-null and has a length less than 4 - */ -+ void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines) throws IllegalArgumentException; + /** + * Send a sign change. This fakes a sign change packet for a user at + * a certain location. This will not actually change the world in any way. @@ -1550,13 +1550,72 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param loc the location of the sign + * @param lines the new text on the sign or null to clear it -+ * @param dyeColor the color of the sign ++ * @throws IllegalArgumentException if location is null ++ * @throws IllegalArgumentException if lines is non-null and has a length less than 4 ++ */ ++ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines) throws IllegalArgumentException { ++ this.sendSignChange(loc, lines, DyeColor.BLACK); ++ } ++ + /** + * Send a sign change. This fakes a sign change packet for a user at + * a certain location. This will not actually change the world in any way. +@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * + * @param loc the location of the sign + * @param lines the new text on the sign or null to clear it ++ * @param dyeColor the color of the sign + * @throws IllegalArgumentException if location is null ++ * @throws IllegalArgumentException if dyeColor is null + * @throws IllegalArgumentException if lines is non-null and has a length less than 4 + */ ++ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException { ++ this.sendSignChange(loc, lines, dyeColor, false); ++ } ++ ++ /** ++ * Send a sign change. This fakes a sign change packet for a user at ++ * a certain location. This will not actually change the world in any way. ++ * This method will use a sign at the location's block or a faked sign ++ * sent via ++ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. ++ *

++ * If the client does not have a sign at the given location it will ++ * display an error message to the user. ++ * ++ * @param loc the location of the sign ++ * @param lines the new text on the sign or null to clear it ++ * @param hasGlowingText whether the text of the sign should glow as if dyed with a glowing ink sac + * @throws IllegalArgumentException if location is null + * @throws IllegalArgumentException if dyeColor is null + * @throws IllegalArgumentException if lines is non-null and has a length less than 4 + */ -+ void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException; ++ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines, boolean hasGlowingText) throws IllegalArgumentException { ++ this.sendSignChange(loc, lines, DyeColor.BLACK, hasGlowingText); ++ } ++ ++ /** ++ * Send a sign change. This fakes a sign change packet for a user at ++ * a certain location. This will not actually change the world in any way. ++ * This method will use a sign at the location's block or a faked sign ++ * sent via ++ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}. ++ *

++ * If the client does not have a sign at the given location it will ++ * display an error message to the user. ++ * ++ * @param loc the location of the sign ++ * @param lines the new text on the sign or null to clear it ++ * @param dyeColor the color of the sign ++ * @param hasGlowingText whether the text of the sign should glow as if dyed with a glowing ink sac ++ * @throws IllegalArgumentException if location is null ++ * @throws IllegalArgumentException if dyeColor is null ++ * @throws IllegalArgumentException if lines is non-null and has a length less than 4 ++ */ ++ void sendSignChange(@NotNull Location loc, @Nullable java.util.List lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) ++ throws IllegalArgumentException; + // Paper end ++ + /** + * Send a sign change. This fakes a sign change packet for a user at + * a certain location. This will not actually change the world in any way. @@ -1576,7 +1635,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Deprecated // Paper public void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException; - + /** @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException if location is null * @throws IllegalArgumentException if dyeColor is null @@ -1586,6 +1645,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Deprecated // Paper public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException; + /** +@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + * @throws IllegalArgumentException if location is null + * @throws IllegalArgumentException if dyeColor is null + * @throws IllegalArgumentException if lines is non-null and has a length less than 4 ++ * @deprecated Deprecated in favour of {@link #sendSignChange(Location, List, DyeColor, boolean)} + */ ++ @Deprecated // Paper + public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException; + /** @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ diff --git a/patches/api/Expose-Tracked-Players.patch b/patches/api/Expose-Tracked-Players.patch index a66700532..68dab829a 100644 --- a/patches/api/Expose-Tracked-Players.patch +++ b/patches/api/Expose-Tracked-Players.patch @@ -8,10 +8,10 @@ diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/buk index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ - package org.bukkit.entity; +@@ -0,0 +0,0 @@ package org.bukkit.entity; import java.net.InetSocketAddress; + import java.util.List; // Paper +import java.util.Set; // Paper import java.util.UUID; import com.destroystokyo.paper.ClientOption; // Paper diff --git a/patches/api/Player-Tab-List-and-Title-APIs.patch b/patches/api/Player-Tab-List-and-Title-APIs.patch index 7d7d129e7..d24aa0512 100644 --- a/patches/api/Player-Tab-List-and-Title-APIs.patch +++ b/patches/api/Player-Tab-List-and-Title-APIs.patch @@ -436,8 +436,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ package org.bukkit.entity; - import java.net.InetSocketAddress; + import java.util.List; // Paper import java.util.UUID; +import com.destroystokyo.paper.Title; // Paper import org.bukkit.DyeColor; diff --git a/patches/api/Player.setPlayerProfile-API.patch b/patches/api/Player.setPlayerProfile-API.patch index a99e290d5..9118dbd7c 100644 --- a/patches/api/Player.setPlayerProfile-API.patch +++ b/patches/api/Player.setPlayerProfile-API.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/buk index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ import java.net.InetSocketAddress; +@@ -0,0 +0,0 @@ import java.util.List; // Paper import java.util.UUID; import com.destroystokyo.paper.Title; // Paper import net.kyori.adventure.text.Component; diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 7ed080d7a..9aac0451b 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2261,11 +2261,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override -+ public void sendSignChange(Location loc, List lines) { -+ this.sendSignChange(loc, lines, org.bukkit.DyeColor.BLACK); -+ } -+ @Override -+ public void sendSignChange(Location loc, List lines, DyeColor dyeColor) { ++ public void sendSignChange(Location loc, @Nullable List lines, DyeColor dyeColor, boolean hasGlowingText) { + if (getHandle().connection == null) { + return; + } @@ -2278,12 +2274,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + throw new IllegalArgumentException("Must have at least 4 lines"); + } + Component[] components = CraftSign.sanitizeLines(lines); -+ this.sendSignChange0(components, loc, dyeColor); ++ this.sendSignChange0(components, loc, dyeColor, hasGlowingText); + } + -+ private void sendSignChange0(Component[] components, Location loc, DyeColor dyeColor) { ++ private void sendSignChange0(Component[] components, Location loc, DyeColor dyeColor, boolean hasGlowingText) { + SignBlockEntity sign = new SignBlockEntity(new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), Blocks.OAK_SIGN.defaultBlockState()); + sign.setColor(net.minecraft.world.item.DyeColor.byId(dyeColor.getWoolData())); ++ sign.setHasGlowingText(hasGlowingText); + System.arraycopy(components, 0, sign.messages, 0, sign.messages.length); + + getHandle().connection.send(sign.getUpdatePacket()); @@ -2291,23 +2288,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end @Override public void sendSignChange(Location loc, String[] lines) { - this.sendSignChange(loc, lines, DyeColor.BLACK); + this.sendSignChange(loc, lines, DyeColor.BLACK); @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } Component[] components = CraftSign.sanitizeLines(lines); - SignBlockEntity sign = new SignBlockEntity(new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), Blocks.OAK_SIGN.defaultBlockState()); -- sign.setColor(net.minecraft.world.item.DyeColor.byId(dyeColor.getWoolData())); -- for (int i = 0; i < components.length; i++) { -- sign.setMessage(i, components[i]); -- } + /*SignBlockEntity sign = new SignBlockEntity(new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), Blocks.OAK_SIGN.defaultBlockState()); -+ sign.setColor(EnumColor.fromColorIndex(dyeColor.getWoolData())); -+ System.arraycopy(components, 0, sign.lines, 0, sign.lines.length); + sign.setColor(net.minecraft.world.item.DyeColor.byId(dyeColor.getWoolData())); + sign.setHasGlowingText(hasGlowingText); + for (int i = 0; i < components.length; i++) { + sign.setMessage(i, components[i]); + } - this.getHandle().connection.send(sign.getUpdatePacket()); + this.getHandle().connection.send(sign.getUpdatePacket());*/ // Paper -+ this.sendSignChange0(components, loc, dyeColor); // Paper ++ this.sendSignChange0(components, loc, dyeColor, hasGlowingText); // Paper } @Override diff --git a/work/Bukkit b/work/Bukkit index 75a0ee4f0..e0598aa29 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 75a0ee4f0481a29f71142a9c0c11e26b1e0d79db +Subproject commit e0598aa29ef8f0622378d929c0ed0542e698db60 diff --git a/work/CraftBukkit b/work/CraftBukkit index e1c96e507..2cdc6b1e4 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit e1c96e507f7019e30e353166645d6dbeaa6c1482 +Subproject commit 2cdc6b1e4cc28d67eeb6397b5650ecc1e13efdfa