mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 979b53a7 Do not allow bee's to load chunks for beehives 13cb8373 Remote Connections shouldn't hold up shutdown 7dac5467 Fix bug in double register fix 87829d83 Remove incorrect IO flush for save-all that doesn't have flush parameter 31e751cb Fix unregistering entities from unloading chunks bc351f6e Ensure Entity is never double registered 2ec0274b Fix many issues with dupe uuid resolve patch 756da10d (Actually) Don't duplicate velocity entry into hidden-configs 9b3679fb Don't duplicate velocity entry into hidden-configs 28cf6540 Pillager patrol spawn settings and per player options (#2924) 6bf04cd5 Reduce entity tracker updates on move
87 lines
4.4 KiB
Diff
87 lines
4.4 KiB
Diff
From 3fe44c34e9c2f2a60eaba70bbda3dadd77495341 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Thu, 6 Jun 2019 17:40:30 -0500
|
|
Subject: [PATCH] Signs allow color codes
|
|
|
|
---
|
|
.../java/net/minecraft/server/EntityPlayer.java | 1 +
|
|
.../net/minecraft/server/PlayerConnection.java | 8 ++++++++
|
|
.../java/net/minecraft/server/TileEntitySign.java | 14 ++++++++++++++
|
|
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
|
|
4 files changed, 25 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index f4fcefc68..cc66f5e1a 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -1131,6 +1131,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|
@Override
|
|
public void openSign(TileEntitySign tileentitysign) {
|
|
tileentitysign.a((EntityHuman) this);
|
|
+ if (world.purpurConfig.signAllowColors) this.playerConnection.sendPacket(tileentitysign.getTranslatedUpdatePacket()); // Purpur
|
|
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
index 7929fcc80..895e34ed3 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -2580,6 +2580,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
}
|
|
}
|
|
// Paper end
|
|
+ // Purpur start
|
|
+ if (worldserver.purpurConfig.signAllowColors) {
|
|
+ lines[i] = astring[i];
|
|
+ if (player.hasPermission("purpur.sign.color")) lines[i] = lines[i].replaceAll("(?i)&([0-9a-fr])", "\u00a7$1");
|
|
+ if (player.hasPermission("purpur.sign.style")) lines[i] = lines[i].replaceAll("(?i)&([l-or])", "\u00a7$1");
|
|
+ if (player.hasPermission("purpur.sign.magic")) lines[i] = lines[i].replaceAll("(?i)&([kr])", "\u00a7$1");
|
|
+ } else
|
|
+ // Purpur end
|
|
lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
|
|
}
|
|
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
|
|
index 099d98e04..19d76c8cc 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
|
|
@@ -89,6 +89,20 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
|
this.g[i] = null;
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public PacketPlayOutTileEntityData getTranslatedUpdatePacket() {
|
|
+ NBTTagCompound nbt = save(new NBTTagCompound());
|
|
+ for (int i = 0; i < 4; ++i) {
|
|
+ String line = lines[i].getLegacyString().replace("\u00a7", "&");
|
|
+ if (line.endsWith("&r")) {
|
|
+ line = line.substring(0, line.length() - 2);
|
|
+ }
|
|
+ nbt.setString("Text" + (i + 1), IChatBaseComponent.ChatSerializer.toJson(new ChatMessage(line)));
|
|
+ }
|
|
+ return new PacketPlayOutTileEntityData(position, 9, nbt);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Nullable
|
|
@Override
|
|
public PacketPlayOutTileEntityData getUpdatePacket() {
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 086bd505c..bf9093158 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -76,8 +76,10 @@ public class PurpurWorldConfig {
|
|
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
|
}
|
|
|
|
+ public boolean signAllowColors = false;
|
|
public boolean signRightClickEdit = false;
|
|
private void signSettings() {
|
|
+ signAllowColors = getBoolean("blocks.sign.allow-colors", signAllowColors);
|
|
signRightClickEdit = getBoolean("blocks.sign.right-click-edit", signRightClickEdit);
|
|
}
|
|
|
|
--
|
|
2.24.0
|
|
|