mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-21 22:36:18 +01:00
Set Minecraft & protocol version in Velocity ping (#5130)
this fixes issues caused by plugins which use the version in the ping
This commit is contained in:
parent
881b8e9b90
commit
2bc3773cb0
1 changed files with 5 additions and 1 deletions
|
@ -31,8 +31,10 @@ import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
import com.velocitypowered.api.proxy.InboundConnection;
|
import com.velocitypowered.api.proxy.InboundConnection;
|
||||||
import com.velocitypowered.api.proxy.ProxyServer;
|
import com.velocitypowered.api.proxy.ProxyServer;
|
||||||
import com.velocitypowered.api.proxy.server.ServerPing;
|
import com.velocitypowered.api.proxy.server.ServerPing;
|
||||||
|
import com.velocitypowered.api.proxy.server.ServerPing.Version;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
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.GeyserPingInfo;
|
||||||
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
|
||||||
|
|
||||||
|
@ -51,7 +53,9 @@ public class GeyserVelocityPingPassthrough implements IGeyserPingPassthrough {
|
||||||
try {
|
try {
|
||||||
event = server.getEventManager().fire(new ProxyPingEvent(new GeyserInboundConnection(inetSocketAddress), ServerPing.builder()
|
event = server.getEventManager().fire(new ProxyPingEvent(new GeyserInboundConnection(inetSocketAddress), ServerPing.builder()
|
||||||
.description(server.getConfiguration().getMotd()).onlinePlayers(server.getPlayerCount())
|
.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) {
|
} catch (ExecutionException | InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue