properly annotate methods in the ServerTransferEvent

This commit is contained in:
onebeastchris 2024-05-02 12:51:14 +02:00
parent 60f8532be3
commit f7c65f38d1

View file

@ -26,6 +26,7 @@
package org.geysermc.geyser.api.event.java; package org.geysermc.geyser.api.event.java;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.common.value.qual.IntRange; import org.checkerframework.common.value.qual.IntRange;
import org.geysermc.geyser.api.connection.GeyserConnection; import org.geysermc.geyser.api.connection.GeyserConnection;
import org.geysermc.geyser.api.event.connection.ConnectionEvent; import org.geysermc.geyser.api.event.connection.ConnectionEvent;
@ -44,7 +45,8 @@ public class ServerTransferEvent extends ConnectionEvent {
private int bedrockPort; private int bedrockPort;
private final Map<String, byte[]> cookies; private final Map<String, byte[]> cookies;
public ServerTransferEvent(@NonNull GeyserConnection connection, String host, int port, Map<String, byte[]> cookies) { public ServerTransferEvent(@NonNull GeyserConnection connection,
@NonNull String host, int port, @NonNull Map<String, byte[]> cookies) {
super(connection); super(connection);
this.host = host; this.host = host;
this.port = port; this.port = port;
@ -58,7 +60,7 @@ public class ServerTransferEvent extends ConnectionEvent {
* *
* @return the host * @return the host
*/ */
public String host() { public @NonNull String host() {
return this.host; return this.host;
} }
@ -77,7 +79,7 @@ public class ServerTransferEvent extends ConnectionEvent {
* *
* @return the host where the Bedrock client will be transferred to, or null if not set. * @return the host where the Bedrock client will be transferred to, or null if not set.
*/ */
public String bedrockHost() { public @Nullable String bedrockHost() {
return this.bedrockHost; return this.bedrockHost;
} }