Commits

md_5 authored cbd95a6b356
SPIGOT-7772: Include hidden / non-sampled players in player count
No tags

nms-patches/net/minecraft/server/network/PacketStatusListener.patch

Modified
103 103 + if (player != null) {
104 104 + EntityPlayer entityPlayer = ((EntityPlayer) player);
105 105 + if (entityPlayer.allowsListing()) {
106 106 + profiles.add(entityPlayer.getGameProfile());
107 107 + } else {
108 108 + profiles.add(MinecraftServer.ANONYMOUS_PLAYER_PROFILE);
109 109 + }
110 110 + }
111 111 + }
112 112 +
113 -+ ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size(), (server.hidesOnlinePlayers()) ? Collections.emptyList() : profiles);
113 ++ ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), event.getNumPlayers(), (server.hidesOnlinePlayers()) ? Collections.emptyList() : profiles);
114 114 +
115 115 + ServerPing ping = new ServerPing(
116 116 + CraftChatMessage.fromString(event.getMotd(), true)[0],
117 117 + Optional.of(playerSample),
118 118 + Optional.of(new ServerPing.ServerData(server.getServerModName() + " " + server.getServerVersion(), SharedConstants.getCurrentVersion().getProtocolVersion())),
119 119 + (event.icon.value != null) ? Optional.of(new ServerPing.a(event.icon.value)) : Optional.empty(),
120 120 + server.enforceSecureProfile()
121 121 + );
122 122 +
123 123 + this.connection.send(new PacketStatusOutServerInfo(ping));

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut