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
This commit is contained in:
Mariell Hoversholm 2021-08-05 21:53:50 +02:00
parent ecbd399610
commit 7df3240f80
9 changed files with 100 additions and 35 deletions

View file

@ -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

View file

@ -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;

View file

@ -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<net.kyori.adventure.text.Component> 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<net.kyori.adventure.text.Component> 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<net.kyori.adventure.text.Component> 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)}.
+ * <p>
+ * 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<net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException;
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<net.kyori.adventure.text.Component> 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)}.
+ * <p>
+ * 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<net.kyori.adventure.text.Component> 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
*/

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -2261,11 +2261,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public void sendSignChange(Location loc, List<net.kyori.adventure.text.Component> lines) {
+ this.sendSignChange(loc, lines, org.bukkit.DyeColor.BLACK);
+ }
+ @Override
+ public void sendSignChange(Location loc, List<net.kyori.adventure.text.Component> lines, DyeColor dyeColor) {
+ public void sendSignChange(Location loc, @Nullable List<net.kyori.adventure.text.Component> 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

@ -1 +1 @@
Subproject commit 75a0ee4f0481a29f71142a9c0c11e26b1e0d79db
Subproject commit e0598aa29ef8f0622378d929c0ed0542e698db60

@ -1 +1 @@
Subproject commit e1c96e507f7019e30e353166645d6dbeaa6c1482
Subproject commit 2cdc6b1e4cc28d67eeb6397b5650ecc1e13efdfa