3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 08:30:12 +01:00

Added a simple way to identify Geyser players.

Keep in mind that using this to identify players is less secure than using Floodgate
Dieser Commit ist enthalten in:
Tim203 2020-01-07 22:29:49 +01:00
Ursprung a4ad4a96bb
Commit c5205cc873
2 geänderte Dateien mit 19 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -95,6 +95,7 @@ public class TranslatorsInit {
public static void start() { public static void start() {
Registry.registerJava(ServerJoinGamePacket.class, new JavaJoinGameTranslator()); Registry.registerJava(ServerJoinGamePacket.class, new JavaJoinGameTranslator());
Registry.registerJava(ServerPluginMessagePacket.class, new JavaPluginMessageTranslator());
Registry.registerJava(ServerChatPacket.class, new JavaChatTranslator()); Registry.registerJava(ServerChatPacket.class, new JavaChatTranslator());
Registry.registerJava(ServerTitlePacket.class, new JavaTitleTranslator()); Registry.registerJava(ServerTitlePacket.class, new JavaTitleTranslator());
Registry.registerJava(ServerUpdateTimePacket.class, new JavaUpdateTimeTranslator()); Registry.registerJava(ServerUpdateTimePacket.class, new JavaUpdateTimeTranslator());

Datei anzeigen

@ -0,0 +1,18 @@
package org.geysermc.connector.network.translators.java;
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientPluginMessagePacket;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerPluginMessagePacket;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.PacketTranslator;
public class JavaPluginMessageTranslator extends PacketTranslator<ServerPluginMessagePacket> {
@Override
public void translate(ServerPluginMessagePacket packet, GeyserSession session) {
if (packet.getChannel().equals("minecraft:brand")) {
session.getDownstream().getSession().send(
new ClientPluginMessagePacket(packet.getChannel(), GeyserConnector.NAME.getBytes())
);
}
}
}