Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Fix message being sent still if a single escape character is sent
Dieser Commit ist enthalten in:
Ursprung
67f4de9781
Commit
af08488d1e
@ -40,11 +40,8 @@ public class BedrockTextTranslator extends PacketTranslator<TextPacket> {
|
|||||||
public void translate(GeyserSession session, TextPacket packet) {
|
public void translate(GeyserSession session, TextPacket packet) {
|
||||||
String message = packet.getMessage();
|
String message = packet.getMessage();
|
||||||
|
|
||||||
if (message.isBlank()) {
|
// The order here is important - strip out illegal characters first, then check if it's blank
|
||||||
// Java Edition (as of 1.17.1) just doesn't pass on these messages, so... we won't either!
|
// (in case the message is blank after removing)
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.indexOf(ChatColor.ESCAPE) != -1) {
|
if (message.indexOf(ChatColor.ESCAPE) != -1) {
|
||||||
// Filter out all escape characters - Java doesn't let you type these
|
// Filter out all escape characters - Java doesn't let you type these
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
@ -57,6 +54,11 @@ public class BedrockTextTranslator extends PacketTranslator<TextPacket> {
|
|||||||
message = builder.toString();
|
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)) {
|
if (MessageTranslator.isTooLong(message, session)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren