Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Set version for pong and StartGamePacket from bedrock packet codec
Dieser Commit ist enthalten in:
Ursprung
5fee344743
Commit
a4b2a016f8
@ -55,48 +55,45 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BedrockPong onQuery(InetSocketAddress inetSocketAddress) {
|
public BedrockPong onQuery(InetSocketAddress inetSocketAddress) {
|
||||||
PingEvent pong = new PingEvent(inetSocketAddress);
|
|
||||||
GeyserLogger.DEFAULT.debug(inetSocketAddress + " has pinged you!");
|
GeyserLogger.DEFAULT.debug(inetSocketAddress + " has pinged you!");
|
||||||
GeyserConfiguration config = connector.getConfig();
|
GeyserConfiguration config = connector.getConfig();
|
||||||
pong.setEdition("MCPE");
|
PingEvent pongEvent = new PingEvent(inetSocketAddress);
|
||||||
pong.setGameType("Default");
|
pongEvent.setEdition("MCPE");
|
||||||
pong.setNintendoLimited(false);
|
pongEvent.setGameType("Default");
|
||||||
pong.setProtocolVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion());
|
pongEvent.setNintendoLimited(false);
|
||||||
pong.setVersion("1.12.0");
|
pongEvent.setProtocolVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getProtocolVersion());
|
||||||
|
pongEvent.setVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
|
||||||
|
|
||||||
connector.getPluginManager().runEvent(pong);
|
connector.getPluginManager().runEvent(pongEvent);
|
||||||
if (connector.getConfig().isPingPassthrough()) {
|
if (connector.getConfig().isPingPassthrough()) {
|
||||||
ServerStatusInfo serverInfo = connector.getPassthroughThread().getInfo();
|
ServerStatusInfo serverInfo = connector.getPassthroughThread().getInfo();
|
||||||
|
|
||||||
if (serverInfo != null) {
|
if (serverInfo != null) {
|
||||||
pong.setMotd(MessageUtils.getBedrockMessage(serverInfo.getDescription()));
|
pongEvent.setMotd(MessageUtils.getBedrockMessage(serverInfo.getDescription()));
|
||||||
pong.setSubMotd(config.getBedrock().getMotd2());
|
pongEvent.setSubMotd(config.getBedrock().getMotd2());
|
||||||
pong.setPlayerCount(serverInfo.getPlayerInfo().getOnlinePlayers());
|
pongEvent.setPlayerCount(serverInfo.getPlayerInfo().getOnlinePlayers());
|
||||||
pong.setMaximumPlayerCount(serverInfo.getPlayerInfo().getMaxPlayers());
|
pongEvent.setMaximumPlayerCount(serverInfo.getPlayerInfo().getMaxPlayers());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pong.setPlayerCount(1);
|
pongEvent.setPlayerCount(1);
|
||||||
pong.setMaximumPlayerCount(config.getMaxPlayers());
|
pongEvent.setMaximumPlayerCount(config.getMaxPlayers());
|
||||||
pong.setMotd(config.getBedrock().getMotd1());
|
pongEvent.setMotd(config.getBedrock().getMotd1());
|
||||||
pong.setSubMotd(config.getBedrock().getMotd2());
|
pongEvent.setSubMotd(config.getBedrock().getMotd2());
|
||||||
}
|
}
|
||||||
|
|
||||||
BedrockPong c = new BedrockPong();
|
BedrockPong pong = new BedrockPong();
|
||||||
|
pong.setEdition(pongEvent.getEdition());
|
||||||
c.setEdition(pong.getEdition());
|
pong.setGameType(pongEvent.getGameType());
|
||||||
c.setGameType(pong.getGameType());
|
pong.setNintendoLimited(pongEvent.isNintendoLimited());
|
||||||
c.setNintendoLimited(pong.isNintendoLimited());
|
pong.setProtocolVersion(pongEvent.getProtocolVersion());
|
||||||
c.setProtocolVersion(pong.getProtocolVersion());
|
pong.setVersion(pongEvent.getVersion());
|
||||||
c.setVersion(pong.getVersion());
|
pong.setMotd(pongEvent.getMotd());
|
||||||
|
pong.setSubMotd(pongEvent.getSubMotd());
|
||||||
c.setMotd(pong.getMotd());
|
pong.setPlayerCount(pongEvent.getPlayerCount());
|
||||||
c.setSubMotd(pong.getSubMotd());
|
pong.setMaximumPlayerCount(pongEvent.getMaximumPlayerCount());
|
||||||
c.setPlayerCount(pong.getPlayerCount());
|
pong.setIpv4Port(config.getBedrock().getPort());
|
||||||
c.setMaximumPlayerCount(pong.getMaximumPlayerCount());
|
|
||||||
c.setIpv4Port(config.getBedrock().getPort());
|
|
||||||
|
|
||||||
return c;
|
|
||||||
|
|
||||||
|
return pong;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -297,7 +297,7 @@ public class GeyserSession implements Player {
|
|||||||
startGamePacket.setMultiplayerCorrelationId("");
|
startGamePacket.setMultiplayerCorrelationId("");
|
||||||
startGamePacket.setBlockPalette(Toolbox.BLOCKS);
|
startGamePacket.setBlockPalette(Toolbox.BLOCKS);
|
||||||
startGamePacket.setItemEntries(Toolbox.ITEMS);
|
startGamePacket.setItemEntries(Toolbox.ITEMS);
|
||||||
startGamePacket.setMovementServerAuthoritative(true);
|
startGamePacket.setVanillaVersion(GeyserConnector.BEDROCK_PACKET_CODEC.getMinecraftVersion());
|
||||||
upstream.sendPacket(startGamePacket);
|
upstream.sendPacket(startGamePacket);
|
||||||
|
|
||||||
PlayStatusPacket playStatusPacket = new PlayStatusPacket();
|
PlayStatusPacket playStatusPacket = new PlayStatusPacket();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren