Skip to content

Commit

Permalink
fix: minecraft version should be included in pong
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Oct 2, 2024
1 parent 524e087 commit 28f053b
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.allaymc.api.i18n.I18n;
import org.allaymc.api.i18n.TrKeys;
import org.allaymc.api.network.NetworkServer;
import org.allaymc.api.network.ProtocolInfo;
import org.allaymc.api.server.Server;
import org.allaymc.api.server.ServerSettings;
import org.allaymc.api.utils.AllayStringUtils;
Expand All @@ -35,8 +36,6 @@

import java.net.InetSocketAddress;

import static org.allaymc.api.network.ProtocolInfo.PACKET_CODEC;

/**
* @author daoge_cmd
*/
Expand Down Expand Up @@ -83,7 +82,7 @@ public void start() {
.childHandler(new BedrockServerInitializer() {
@Override
protected void initSession(BedrockServerSession session) {
session.setCodec(PACKET_CODEC);
session.setCodec(ProtocolInfo.PACKET_CODEC);

var server = Server.getInstance();
if (server.isIPBanned(AllayStringUtils.fastTwoPartSplit(session.getSocketAddress().toString().substring(1), ":", "")[0])) {
Expand Down Expand Up @@ -116,7 +115,7 @@ public void shutdown() {

@Override
public BedrockCodec getCodec() {
return PACKET_CODEC;
return ProtocolInfo.PACKET_CODEC;
}

@Override
Expand Down Expand Up @@ -156,7 +155,8 @@ protected BedrockPong initPong(ServerSettings settings) {
.playerCount(0)
.maximumPlayerCount(settings.genericSettings().maxClientCount())
.gameType(settings.genericSettings().defaultGameType().name())
.protocolVersion(PACKET_CODEC.getProtocolVersion())
.version(ProtocolInfo.getMinecraftVersionStr())
.protocolVersion(ProtocolInfo.PACKET_CODEC.getProtocolVersion())
.ipv4Port(settings.networkSettings().port())
.ipv6Port(settings.networkSettings().port()); // TODO: ipv6
}
Expand Down

0 comments on commit 28f053b

Please sign in to comment.