Skip to content

Commit

Permalink
set Minecraft & protocol version in Velocity ping
Browse files Browse the repository at this point in the history
this fixes issues caused by plugins which use the version in the ping
  • Loading branch information
Kladki committed Nov 6, 2024
1 parent 6983095 commit 3cf96fa
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
import com.velocitypowered.api.proxy.InboundConnection;
import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.server.ServerPing;
import com.velocitypowered.api.proxy.server.ServerPing.Version;
import lombok.AllArgsConstructor;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.ping.GeyserPingInfo;
import org.geysermc.geyser.ping.IGeyserPingPassthrough;

Expand All @@ -51,7 +53,9 @@ public GeyserPingInfo getPingInformation(InetSocketAddress inetSocketAddress) {
try {
event = server.getEventManager().fire(new ProxyPingEvent(new GeyserInboundConnection(inetSocketAddress), ServerPing.builder()
.description(server.getConfiguration().getMotd()).onlinePlayers(server.getPlayerCount())
.maximumPlayers(server.getConfiguration().getShowMaxPlayers()).build())).get();
.maximumPlayers(server.getConfiguration().getShowMaxPlayers())
.version(new Version(GameProtocol.getJavaProtocolVersion(), GameProtocol.getJavaMinecraftVersion()))
.build())).get();
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 3cf96fa

Please sign in to comment.