mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
OBFHELPERS (#4733)
This commit is contained in:
parent
c208709558
commit
0b2f49cb81
2 changed files with 15 additions and 5 deletions
|
@ -13,8 +13,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
- lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a((String) list.get(i))).getString());
|
||||
+ // Paper TODO(Proximyst): Add obfhelper when 1.16.4 runs
|
||||
+ lines[i] = SharedConstants.a(list.get(i)); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
|
||||
+ lines[i] = SharedConstants.filterAllowedChatCharacters(list.get(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);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/server/SharedConstants.java b/src/main/java/net/minecraft/server/SharedConstants.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/SharedConstants.java
|
||||
+++ b/src/main/java/net/minecraft/server/SharedConstants.java
|
||||
@@ -0,0 +0,0 @@ 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();
|
||||
|
|
|
@ -37,6 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
String[] lines = new String[4];
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
- lines[i] = SharedConstants.filterAllowedChatCharacters(list.get(i)); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
|
||||
+ // Paper start - cap line length - modified clients can send longer data than normal
|
||||
+ String currentLine = list.get(i);
|
||||
+ if (MAX_SIGN_LINE_LENGTH > 0 && currentLine.length() > MAX_SIGN_LINE_LENGTH) {
|
||||
|
@ -47,9 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
// Paper TODO(Proximyst): Add obfhelper when 1.16.4 runs
|
||||
- lines[i] = SharedConstants.a(list.get(i)); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
|
||||
+ lines[i] = SharedConstants.a(currentLine); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
|
||||
+ lines[i] = SharedConstants.filterAllowedChatCharacters(currentLine); // 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);
|
||||
this.server.getPluginManager().callEvent(event);
|
||||
|
|
Loading…
Reference in a new issue