diff --git a/paper-api/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/paper-api/src/main/java/org/bukkit/event/server/ServerListPingEvent.java index b9abfdc61f..92941af574 100644 --- a/paper-api/src/main/java/org/bukkit/event/server/ServerListPingEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/server/ServerListPingEvent.java @@ -21,15 +21,17 @@ public class ServerListPingEvent extends ServerEvent implements Iterable private static final int MAGIC_PLAYER_COUNT = Integer.MIN_VALUE; private static final HandlerList handlers = new HandlerList(); private final InetAddress address; + private final boolean shouldSendChatPreviews; private String motd; private final int numPlayers; private int maxPlayers; - public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final int numPlayers, final int maxPlayers) { + public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, final boolean shouldSendChatPreviews, final int numPlayers, final int maxPlayers) { super(true); Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online", numPlayers); this.address = address; this.motd = motd; + this.shouldSendChatPreviews = shouldSendChatPreviews; this.numPlayers = numPlayers; this.maxPlayers = maxPlayers; } @@ -41,13 +43,15 @@ public class ServerListPingEvent extends ServerEvent implements Iterable * * @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 InetAddress address, @NotNull final String motd, final int maxPlayers) { + protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final String motd, boolean shouldSendChatPreviews, final int maxPlayers) { super(true); this.numPlayers = MAGIC_PLAYER_COUNT; this.address = address; this.motd = motd; + this.shouldSendChatPreviews = shouldSendChatPreviews; this.maxPlayers = maxPlayers; } @@ -105,6 +109,16 @@ public class ServerListPingEvent extends ServerEvent implements Iterable return maxPlayers; } + /** + * Gets whether the server needs to send a preview of the chat to the + * client. + * + * @return true if chat preview is enabled, false otherwise + */ + public boolean shouldSendChatPreviews() { + return shouldSendChatPreviews; + } + /** * Set the maximum number of players sent. *