From ff8015faaae933b91bdd094b27ca18addfd26327 Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:54:38 +0200 Subject: [PATCH] Add nullable annotation --- .../java/org/geysermc/mcprotocollib/network/Session.java | 4 ++-- .../org/geysermc/mcprotocollib/network/tcp/TcpSession.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/network/Session.java b/protocol/src/main/java/org/geysermc/mcprotocollib/network/Session.java index 9e8c41654..054c76ff1 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/network/Session.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/network/Session.java @@ -189,7 +189,7 @@ public interface Session { * @param compressionConfig the compression to compress with, * or null to disable compression */ - void setCompression(CompressionConfig compressionConfig); + void setCompression(@Nullable CompressionConfig compressionConfig); /** * Sets encryption for this session. @@ -198,7 +198,7 @@ public interface Session { * or null to disable encryption * */ - void setEncryption(EncryptionConfig encryptionConfig); + void setEncryption(@Nullable EncryptionConfig encryptionConfig); /** * Returns true if the session is connected. diff --git a/protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpSession.java b/protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpSession.java index b36fb6d7b..4fb7641b8 100644 --- a/protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpSession.java +++ b/protocol/src/main/java/org/geysermc/mcprotocollib/network/tcp/TcpSession.java @@ -187,7 +187,7 @@ public void callPacketSent(Packet packet) { } @Override - public void setCompression(CompressionConfig compressionConfig) { + public void setCompression(@Nullable CompressionConfig compressionConfig) { if (this.channel == null) { throw new IllegalStateException("You need to connect to set the compression!"); } @@ -196,9 +196,9 @@ public void setCompression(CompressionConfig compressionConfig) { } @Override - public void setEncryption(EncryptionConfig encryptionConfig) { + public void setEncryption(@Nullable EncryptionConfig encryptionConfig) { if (channel == null) { - throw new IllegalStateException("You need to connect to enable encryption!"); + throw new IllegalStateException("You need to connect to set the encryption!"); } channel.attr(NetworkConstants.ENCRYPTION_ATTRIBUTE_KEY).set(encryptionConfig);