Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Missed instance of Outdated server
Dieser Commit ist enthalten in:
Ursprung
f8e983887e
Commit
732fd90d48
@ -37,6 +37,8 @@ import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
|||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Translator(packet = ClientboundLoginDisconnectPacket.class)
|
@Translator(packet = ClientboundLoginDisconnectPacket.class)
|
||||||
public class JavaLoginDisconnectTranslator extends PacketTranslator<ClientboundLoginDisconnectPacket> {
|
public class JavaLoginDisconnectTranslator extends PacketTranslator<ClientboundLoginDisconnectPacket> {
|
||||||
|
|
||||||
@ -44,7 +46,7 @@ public class JavaLoginDisconnectTranslator extends PacketTranslator<ClientboundL
|
|||||||
public void translate(GeyserSession session, ClientboundLoginDisconnectPacket packet) {
|
public void translate(GeyserSession session, ClientboundLoginDisconnectPacket packet) {
|
||||||
Component disconnectReason = packet.getReason();
|
Component disconnectReason = packet.getReason();
|
||||||
|
|
||||||
boolean isOutdatedMessage;
|
boolean isOutdatedMessage = false;
|
||||||
if (disconnectReason instanceof TranslatableComponent component) {
|
if (disconnectReason instanceof TranslatableComponent component) {
|
||||||
String key = component.key();
|
String key = component.key();
|
||||||
isOutdatedMessage = "multiplayer.disconnect.incompatible".equals(key) ||
|
isOutdatedMessage = "multiplayer.disconnect.incompatible".equals(key) ||
|
||||||
@ -53,9 +55,21 @@ public class JavaLoginDisconnectTranslator extends PacketTranslator<ClientboundL
|
|||||||
// Reproduced on 1.15.2 server with ViaVersion 4.0.0-21w20a with 1.18.2 Java client
|
// Reproduced on 1.15.2 server with ViaVersion 4.0.0-21w20a with 1.18.2 Java client
|
||||||
|| key.startsWith("Outdated server!");
|
|| key.startsWith("Outdated server!");
|
||||||
} else {
|
} else {
|
||||||
|
if (disconnectReason instanceof TextComponent component) {
|
||||||
|
if (component.content().startsWith("Outdated server!")) {
|
||||||
// Reproduced with vanilla 1.8.8 server and 1.18.2 Java client
|
// Reproduced with vanilla 1.8.8 server and 1.18.2 Java client
|
||||||
isOutdatedMessage = disconnectReason instanceof TextComponent component
|
isOutdatedMessage = true;
|
||||||
&& component.content().startsWith("Outdated server!");
|
} else {
|
||||||
|
List<Component> children = component.children();
|
||||||
|
for (int i = 0; i < children.size(); i++) {
|
||||||
|
if (children.get(i) instanceof TextComponent child && child.content().startsWith("Outdated server!")) {
|
||||||
|
// Reproduced on Paper 1.17.1
|
||||||
|
isOutdatedMessage = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String serverDisconnectMessage = MessageTranslator.convertMessage(disconnectReason, session.getLocale());
|
String serverDisconnectMessage = MessageTranslator.convertMessage(disconnectReason, session.getLocale());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren