mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix message being sent still if a single escape character is sent
This commit is contained in:
parent
67f4de9781
commit
af08488d1e
1 changed files with 7 additions and 5 deletions
|
@ -40,11 +40,8 @@ public class BedrockTextTranslator extends PacketTranslator<TextPacket> {
|
|||
public void translate(GeyserSession session, TextPacket packet) {
|
||||
String message = packet.getMessage();
|
||||
|
||||
if (message.isBlank()) {
|
||||
// Java Edition (as of 1.17.1) just doesn't pass on these messages, so... we won't either!
|
||||
return;
|
||||
}
|
||||
|
||||
// The order here is important - strip out illegal characters first, then check if it's blank
|
||||
// (in case the message is blank after removing)
|
||||
if (message.indexOf(ChatColor.ESCAPE) != -1) {
|
||||
// Filter out all escape characters - Java doesn't let you type these
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -57,6 +54,11 @@ public class BedrockTextTranslator extends PacketTranslator<TextPacket> {
|
|||
message = builder.toString();
|
||||
}
|
||||
|
||||
if (message.isBlank()) {
|
||||
// Java Edition (as of 1.17.1) just doesn't pass on these messages, so... we won't either!
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageTranslator.isTooLong(message, session)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue