-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to allow players sending illegal characters in chat
- Loading branch information
1 parent
5abc439
commit 972fd89
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
patches/server/0046-Allow-players-sending-illegal-characters-in-chat.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Dreeam <[email protected]> | ||
Date: Tue, 30 Jan 2024 10:02:58 -0500 | ||
Subject: [PATCH] Allow players sending illegal characters in chat | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
index 23828b5d2300d64ac5a5c1a5da1bb1ee14f45d24..12615924ba9aa5753fc46b9d005003222aa92503 100644 | ||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java | ||
@@ -2204,7 +2204,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl | ||
return; | ||
} | ||
// CraftBukkit end | ||
- if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { | ||
+ if (!org.dreeam.leaf.LeafConfig.allowIllegalCharactersInChat && ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { | ||
this.server.scheduleOnMain(() -> { // Paper - push to main for event firing | ||
this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause | ||
}); // Paper - push to main for event firing | ||
@@ -2239,7 +2239,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl | ||
|
||
@Override | ||
public void handleChatCommand(ServerboundChatCommandPacket packet) { | ||
- if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { | ||
+ if (!org.dreeam.leaf.LeafConfig.allowIllegalCharactersInChat && ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { | ||
this.server.scheduleOnMain(() -> { // Paper - push to main for event firing | ||
this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper | ||
}); // Paper - push to main for event firing | ||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | ||
index 718d6341fb440b8139b6ee75a17b07ed07221627..3b59170ff29ed7b081804ccb772c20fa59e6b644 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | ||
@@ -703,7 +703,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { | ||
if (this.getHandle().connection == null) return; | ||
|
||
// Paper start - Improve chat handling | ||
- if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) { | ||
+ if (!org.dreeam.leaf.LeafConfig.allowIllegalCharactersInChat && ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) { | ||
this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - kick event causes | ||
} else { | ||
if (msg.startsWith("/")) { | ||
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java | ||
index 2156073db27fc58e326c2c8fa4dd48dc27fe8323..50b9b608696a25c424d633fc7b3220272e307c5c 100644 | ||
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java | ||
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java | ||
@@ -305,4 +305,9 @@ public class LeafConfig { | ||
gg.pufferfish.pufferfish.sentry.SentryManager.init(); | ||
} | ||
} | ||
+ | ||
+ public static boolean allowIllegalCharactersInChat = false; | ||
+ private static void illegalCharacters() { | ||
+ allowIllegalCharactersInChat = getBoolean("allow-illegal-characters-in-chat", allowIllegalCharactersInChat); | ||
+ } | ||
} |