2020-05-06 11:48:49 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2018-04-26 10:51:54 +02:00
From: 0x22 <0x22@futureclient.net>
Date: Thu, 26 Apr 2018 04:41:11 -0400
Subject: [PATCH] Fix exploit that allowed colored signs to be created
2021-03-16 08:19:45 +01:00
diff --git a/src/main/java/net/minecraft/SharedConstants.java b/src/main/java/net/minecraft/SharedConstants.java
index b92975aa85fd79c70d6bec014284e8f55d0d3a4b..d5d6c545182b9b0b6aa5e52f1f9858450a17038e 100644
--- a/src/main/java/net/minecraft/SharedConstants.java
+++ b/src/main/java/net/minecraft/SharedConstants.java
@@ -20,6 +20,7 @@ public class SharedConstants {
return c0 != 167 && c0 >= ' ' && c0 != 127;
}
+ public static String filterAllowedChatCharacters(String input) { return a(input); } // Paper - OBFHELPER
public static String a(String s) {
StringBuilder stringbuilder = new StringBuilder();
char[] achar = s.toCharArray();
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
2021-05-25 00:37:30 +02:00
index 1860def3971d1e17429bdde51c2bc336887da233..6c5966901ffdc3c7f9950ff8b40fbf2489acbd4b 100644
2021-03-16 08:19:45 +01:00
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
2021-05-25 00:37:30 +02:00
@@ -2788,7 +2788,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
2021-02-21 20:45:33 +01:00
List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
2018-04-26 10:51:54 +02:00
2020-11-03 03:22:15 +01:00
for (int i = 0; i < list.size(); ++i) {
2021-02-21 20:45:33 +01:00
- lines.add(net.kyori.adventure.text.Component.text(list.get(i)));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterAllowedChatCharacters(list.get(i)))); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
2018-04-26 10:51:54 +02:00
}
2021-02-21 20:45:33 +01:00
SignChangeEvent event = new SignChangeEvent(org.bukkit.craftbukkit.block.CraftBlock.at(worldserver, blockposition), this.getPlayer(), lines);
2018-04-26 10:51:54 +02:00
this.server.getPluginManager().callEvent(event);