Require non-null reason (#1823)

This commit is contained in:
Wouter Gritter
2026-06-15 16:47:31 +02:00
committed by GitHub
parent 1b64a70a00
commit 3b892899db
2 changed files with 4 additions and 2 deletions

View File

@@ -197,7 +197,7 @@ public interface Player extends
* *
* @param reason component with the reason * @param reason component with the reason
*/ */
void disconnect(Component reason); void disconnect(@NotNull Component reason);
/** /**
* Sends chat input onto the players current server as if they typed it into the client chat box. * Sends chat input onto the players current server as if they typed it into the client chat box.

View File

@@ -111,6 +111,7 @@ import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@@ -645,7 +646,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
} }
@Override @Override
public void disconnect(Component reason) { public void disconnect(@NotNull Component reason) {
Objects.requireNonNull(reason, "reason");
if (connection.eventLoop().inEventLoop()) { if (connection.eventLoop().inEventLoop()) {
disconnect0(reason, false); disconnect0(reason, false);
} else { } else {