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: cb15cfa4 Improve Async Login so pending connections dont get exposed f275e9cb Optimize Hoppers - Major Boost - Got2GoFast! 0106485c Improvements to watchdog changes 65934b1f Fix build for last commit. 5am commits are great 3f436029 Don't process watchdog until server has fully started and ticked. 938bd972 Don't fire BlockFade on worldgen threads - Fixes #3208 509a828e Fix loading spawn chunks when async chunks is off 8a91bfd2 Improvements to async login bf698865 Revert "Re-track players that dismount from other players" 82b98418 Fix some issues with async login as well another source of sync loads aa241d2b Allow multiple callbacks to schedule for Callback Executor a2064a41 Add PlayerAttackEntityCooldownResetEvent This event is called when processing a player's attack on an entity right before their attack strength cd is reset, there are no existing events that fire within this period of time so it was impossible to capture the players attack strength via API prior to this commit. f48d4299 Allow sleeping players to float eeb2f67d Fix Bed respawn deviating too far from vanilla (#3195) 68a7b9fe Move player to spawn point if spawn in unloaded world
87 lines
4.4 KiB
Diff
87 lines
4.4 KiB
Diff
From 5bb0a2beb7da572024b6526ed816483b03d0a8f1 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 8404fc4e..51933a49 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -1129,6 +1129,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 b62535ba..3c37d032 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -2581,6 +2581,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 099d98e0..19d76c8c 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 0894523d..3c7f545e 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
|
|
|