[ci skip] Cleanup events (#10202)

This commit is contained in:
Lulu13022002
2024-02-01 10:15:57 +01:00
parent d676979ea0
commit f7e469eb2e
187 changed files with 2415 additions and 2258 deletions

View File

@@ -30,6 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.NoSuchElementException;
+import java.util.UUID;
+
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
@@ -56,6 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private Object[] players;
+
+ @Deprecated
+ @ApiStatus.Internal
+ public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull String motd, int numPlayers, int maxPlayers,
+ @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
+ super("", client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
@@ -66,6 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ setServerIcon(favicon);
+ }
+
+ @ApiStatus.Internal
+ public PaperServerListPingEvent(@NotNull StatusClient client, @NotNull net.kyori.adventure.text.Component motd, int numPlayers, int maxPlayers,
+ @NotNull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
+ super("", client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
@@ -103,9 +106,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ /**
+ * Sets the number of players displayed in the server list.
+ *
+ * <p>Note that this won't have any effect if {@link #shouldHidePlayers()}
+ * is enabled.</p>
+ * <p>
+ * Note that this won't have any effect if {@link #shouldHidePlayers()}
+ * is enabled.
+ *
+ * @param numPlayers The number of online players
+ */
@@ -118,9 +121,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Returns {@code -1} if players are hidden using
+ * {@link #shouldHidePlayers()}.</p>
+ * <p>
+ * Returns {@code -1} if players are hidden using
+ * {@link #shouldHidePlayers()}.
+ */
+ @Override
+ public int getMaxPlayers() {
@@ -135,23 +138,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Returns whether all player related information is hidden in the server
+ * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()}
+ * and {@link #getPlayerSample()} to be skipped in the response.
+ *
+ * <p>The Vanilla Minecraft client will display the player count as {@code ???}
+ * when this option is enabled.</p>
+ * <p>
+ * The Vanilla Minecraft client will display the player count as {@code ???}
+ * when this option is enabled.
+ *
+ * @return {@code true} if the player count is hidden
+ */
+ public boolean shouldHidePlayers() {
+ return hidePlayers;
+ return this.hidePlayers;
+ }
+
+ /**
+ * Sets whether all player related information is hidden in the server
+ * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()}
+ * and {@link #getPlayerSample()} to be skipped in the response.
+ *
+ * <p>The Vanilla Minecraft client will display the player count as {@code ???}
+ * when this option is enabled.</p>
+ * <p>
+ * The Vanilla Minecraft client will display the player count as {@code ???}
+ * when this option is enabled.
+ *
+ * @param hidePlayers {@code true} if the player count should be hidden
+ */
@@ -162,9 +165,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ /**
+ * Returns a mutable list of {@link PlayerProfile} that will be displayed
+ * as online players on the client.
+ *
+ * <p>The Vanilla Minecraft client will display them when hovering the
+ * player count with the mouse.</p>
+ * <p>
+ * The Vanilla Minecraft client will display them when hovering the
+ * player count with the mouse.
+ *
+ * @return The mutable player sample list
+ */
@@ -180,7 +183,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @NotNull
+ public String getVersion() {
+ return version;
+ return this.version;
+ }
+
+ /**
@@ -200,7 +203,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * has not finished initialization yet
+ */
+ public int getProtocolVersion() {
+ return protocolVersion;
+ return this.protocolVersion;
+ }
+
+ /**
@@ -240,9 +243,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Cancelling this event will cause the connection to be closed immediately,
+ * without sending a response to the client.</p>
+ * <p>
+ * Cancelling this event will cause the connection to be closed immediately,
+ * without sending a response to the client.
+ */
+ @Override
+ public boolean isCancelled() {
@@ -251,9 +254,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Cancelling this event will cause the connection to be closed immediately,
+ * without sending a response to the client.</p>
+ * <p>
+ * Cancelling this event will cause the connection to be closed immediately,
+ * without sending a response to the client.
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
@@ -262,10 +265,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p><b>Note:</b> For compatibility reasons, this method will return all
+ * <p>
+ * <b>Note:</b> For compatibility reasons, this method will return all
+ * online players, not just the ones referenced in {@link #getPlayerSample()}.
+ * Removing a player will:</p>
+ * Removing a player will:
+ *
+ * <ul>
+ * <li>Decrement the online player count (if and only if) the player
@@ -294,6 +297,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return (Player) player;
+ }
+
+ @ApiStatus.Internal
+ private final class PlayerIterator implements Iterator<Player> {
+
+ private int next;