mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 04:32:11 -07:00
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
public class ServerStatusPacketListenerImpl implements ServerStatusPacketListener {
|
public class ServerStatusPacketListenerImpl implements ServerStatusPacketListener {
|
||||||
|
|
||||||
@@ -36,7 +49,101 @@
|
@@ -36,7 +49,108 @@
|
||||||
this.connection.disconnect(ServerStatusPacketListenerImpl.DISCONNECT_REASON);
|
this.connection.disconnect(ServerStatusPacketListenerImpl.DISCONNECT_REASON);
|
||||||
} else {
|
} else {
|
||||||
this.hasRequestedStatus = true;
|
this.hasRequestedStatus = true;
|
||||||
@@ -108,6 +108,13 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ // Spigot Start
|
||||||
|
+ if ( !server.hidesOnlinePlayers() && !profiles.isEmpty() )
|
||||||
|
+ {
|
||||||
|
+ java.util.Collections.shuffle( profiles ); // This sucks, its inefficient but we have no simple way of doing it differently
|
||||||
|
+ profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour
|
||||||
|
+ }
|
||||||
|
+ // Spigot End
|
||||||
+ ServerStatus.Players playerSample = new ServerStatus.Players(event.getMaxPlayers(), event.getNumPlayers(), (server.hidesOnlinePlayers()) ? Collections.emptyList() : profiles);
|
+ ServerStatus.Players playerSample = new ServerStatus.Players(event.getMaxPlayers(), event.getNumPlayers(), (server.hidesOnlinePlayers()) ? Collections.emptyList() : profiles);
|
||||||
+
|
+
|
||||||
+ ServerStatus ping = new ServerStatus(
|
+ ServerStatus ping = new ServerStatus(
|
||||||
|
@@ -271,4 +271,11 @@ public class SpigotConfig
|
|||||||
{
|
{
|
||||||
SpigotConfig.commands.put( "tps", new TicksPerSecondCommand( "tps" ) );
|
SpigotConfig.commands.put( "tps", new TicksPerSecondCommand( "tps" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int playerSample;
|
||||||
|
private static void playerSample()
|
||||||
|
{
|
||||||
|
SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 );
|
||||||
|
System.out.println( "Server Ping Player Sample Count: " + SpigotConfig.playerSample );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user