|
|
|
|
@@ -22,32 +22,20 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
|
|
|
|
|
private static final HandlerList handlers = new HandlerList();
|
|
|
|
|
private final String hostname;
|
|
|
|
|
private final InetAddress address;
|
|
|
|
|
private final boolean shouldSendChatPreviews;
|
|
|
|
|
private String motd;
|
|
|
|
|
private final int numPlayers;
|
|
|
|
|
private int maxPlayers;
|
|
|
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
|
public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final boolean shouldSendChatPreviews, final int numPlayers, final int maxPlayers) {
|
|
|
|
|
this("", address, motd, shouldSendChatPreviews, numPlayers, maxPlayers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final String motd, final boolean shouldSendChatPreviews, final int numPlayers, final int maxPlayers) {
|
|
|
|
|
public ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final String motd, final int numPlayers, final int maxPlayers) {
|
|
|
|
|
super(true);
|
|
|
|
|
Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
|
|
|
|
|
this.hostname = hostname;
|
|
|
|
|
this.address = address;
|
|
|
|
|
this.motd = motd;
|
|
|
|
|
this.shouldSendChatPreviews = shouldSendChatPreviews;
|
|
|
|
|
this.numPlayers = numPlayers;
|
|
|
|
|
this.maxPlayers = maxPlayers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
|
protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, boolean shouldSendChatPreviews, final int maxPlayers) {
|
|
|
|
|
this("", address, motd, shouldSendChatPreviews, maxPlayers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This constructor is intended for implementations that provide the
|
|
|
|
|
* {@link #iterator()} method, thus provided the {@link #getNumPlayers()}
|
|
|
|
|
@@ -56,16 +44,14 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
|
|
|
|
|
* @param hostname The hostname that was used to connect to the server
|
|
|
|
|
* @param address the address of the pinger
|
|
|
|
|
* @param motd the message of the day
|
|
|
|
|
* @param shouldSendChatPreviews if the server should send chat previews
|
|
|
|
|
* @param maxPlayers the max number of players
|
|
|
|
|
*/
|
|
|
|
|
protected ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final String motd, boolean shouldSendChatPreviews, final int maxPlayers) {
|
|
|
|
|
protected ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final String motd, final int maxPlayers) {
|
|
|
|
|
super(true);
|
|
|
|
|
this.numPlayers = MAGIC_PLAYER_COUNT;
|
|
|
|
|
this.hostname = hostname;
|
|
|
|
|
this.address = address;
|
|
|
|
|
this.motd = motd;
|
|
|
|
|
this.shouldSendChatPreviews = shouldSendChatPreviews;
|
|
|
|
|
this.maxPlayers = maxPlayers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -139,9 +125,11 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
|
|
|
|
|
* client.
|
|
|
|
|
*
|
|
|
|
|
* @return true if chat preview is enabled, false otherwise
|
|
|
|
|
* @deprecated chat previews have been removed
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public boolean shouldSendChatPreviews() {
|
|
|
|
|
return shouldSendChatPreviews;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|