From e7e40f59bae71d37952a3edb50887b0dabe5525b Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sun, 1 Sep 2024 20:45:10 +0200 Subject: [PATCH] Deprecate all the API classes that will be removed in Floodgate 3.0 See #536 for more information --- .../floodgate/api/InstanceHolder.java | 33 +++++++++++++++++-- .../api/handshake/HandshakeData.java | 7 ++-- .../api/handshake/HandshakeHandler.java | 9 ++--- .../api/handshake/HandshakeHandlers.java | 6 ++-- .../floodgate/api/inject/InjectorAddon.java | 5 +++ .../api/inject/PlatformInjector.java | 8 ++--- .../floodgate/api/packet/PacketHandler.java | 4 ++- .../floodgate/api/packet/PacketHandlers.java | 5 +++ 8 files changed, 52 insertions(+), 25 deletions(-) diff --git a/api/src/main/java/org/geysermc/floodgate/api/InstanceHolder.java b/api/src/main/java/org/geysermc/floodgate/api/InstanceHolder.java index 159310ee..e9730b10 100644 --- a/api/src/main/java/org/geysermc/floodgate/api/InstanceHolder.java +++ b/api/src/main/java/org/geysermc/floodgate/api/InstanceHolder.java @@ -38,9 +38,9 @@ public final class InstanceHolder { @Getter private static PlayerLink playerLink; @Getter private static FloodgateEventBus eventBus; - @Getter private static PlatformInjector injector; - @Getter private static PacketHandlers packetHandlers; - @Getter private static HandshakeHandlers handshakeHandlers; + private static PlatformInjector injector; + private static PacketHandlers packetHandlers; + private static HandshakeHandlers handshakeHandlers; private static UUID storedKey; public static boolean set( @@ -68,4 +68,31 @@ public static boolean set( InstanceHolder.handshakeHandlers = handshakeHandlers; return true; } + + /** + * @deprecated Injector addons will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. + */ + @Deprecated + public static PlatformInjector getInjector() { + return InstanceHolder.injector; + } + + /** + * @deprecated Packet handlers will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. + */ + @Deprecated + public static PacketHandlers getPacketHandlers() { + return InstanceHolder.packetHandlers; + } + + /** + * @deprecated Handshake handlers will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. + */ + @Deprecated + public static HandshakeHandlers getHandshakeHandlers() { + return InstanceHolder.handshakeHandlers; + } } diff --git a/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeData.java b/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeData.java index 1ebc6525..9c1569a6 100644 --- a/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeData.java +++ b/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeData.java @@ -31,11 +31,8 @@ import org.geysermc.floodgate.util.LinkedPlayer; /** - * For advanced users only! You shouldn't play with this unless you know what you're doing.
- *
- * This class allows you change specific things of a Bedrock player before it is applied to the - * server. Note that at the time I'm writing this that the HandshakeData is created after requesting - * the player link. So the link is present here, if applicable. + * @deprecated Handshake handlers will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. */ @Deprecated public interface HandshakeData { diff --git a/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeHandler.java b/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeHandler.java index 8ce06253..cab9ef93 100644 --- a/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeHandler.java +++ b/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeHandler.java @@ -26,13 +26,8 @@ package org.geysermc.floodgate.api.handshake; /** - * This class allows you to change and/or get specific data of the Bedrock client before Floodgate - * does something with this data. This means that Floodgate decrypts the data, then calls the - * handshake handlers and then applies the data to the connection.
- *
- * /!\ Note that this class will be called for both Java and Bedrock connections, but {@link - * HandshakeData#isFloodgatePlayer()} will be false and Floodgate related methods will return null - * for Java players + * @deprecated Handshake handlers will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. */ @Deprecated @FunctionalInterface diff --git a/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeHandlers.java b/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeHandlers.java index 088ac9af..2d69a1ea 100644 --- a/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeHandlers.java +++ b/api/src/main/java/org/geysermc/floodgate/api/handshake/HandshakeHandlers.java @@ -26,10 +26,8 @@ package org.geysermc.floodgate.api.handshake; /** - * @deprecated This system has been deprecated and will not be available in the new API that will be - * introduced when Geyser will include Floodgate (and thus will have some common base API). - *
- * It might be replaced with an event (probably internal), but that isn't certain yet. + * @deprecated Handshake handlers will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. */ @Deprecated public interface HandshakeHandlers { diff --git a/api/src/main/java/org/geysermc/floodgate/api/inject/InjectorAddon.java b/api/src/main/java/org/geysermc/floodgate/api/inject/InjectorAddon.java index ee991b78..01fbc3cd 100644 --- a/api/src/main/java/org/geysermc/floodgate/api/inject/InjectorAddon.java +++ b/api/src/main/java/org/geysermc/floodgate/api/inject/InjectorAddon.java @@ -27,6 +27,11 @@ import io.netty.channel.Channel; +/** + * @deprecated Injector addons will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. + */ +@Deprecated public interface InjectorAddon { /** * Called when injecting a specific channel (every client that is connected to the server has diff --git a/api/src/main/java/org/geysermc/floodgate/api/inject/PlatformInjector.java b/api/src/main/java/org/geysermc/floodgate/api/inject/PlatformInjector.java index 4c28ac40..026fb08a 100644 --- a/api/src/main/java/org/geysermc/floodgate/api/inject/PlatformInjector.java +++ b/api/src/main/java/org/geysermc/floodgate/api/inject/PlatformInjector.java @@ -26,12 +26,10 @@ package org.geysermc.floodgate.api.inject; /** - * The global interface of all the Platform Injectors. The injector can be used for various things. - * It is used internally for getting Floodgate data out of the handshake packet and for debug mode, - * but there is also an option to add your own addons. Note that every Floodgate platform that - * supports netty should implement this, but the platform implementation isn't required to implement - * this. + * @deprecated Injector addons will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. */ +@Deprecated public interface PlatformInjector { /** * Injects the server connection. This will allow various addons (like getting the Floodgate diff --git a/api/src/main/java/org/geysermc/floodgate/api/packet/PacketHandler.java b/api/src/main/java/org/geysermc/floodgate/api/packet/PacketHandler.java index 3170175c..1ddb9cf3 100644 --- a/api/src/main/java/org/geysermc/floodgate/api/packet/PacketHandler.java +++ b/api/src/main/java/org/geysermc/floodgate/api/packet/PacketHandler.java @@ -28,8 +28,10 @@ import io.netty.channel.ChannelHandlerContext; /** - * For advanced users only! You shouldn't play with this unless you know what you're doing. + * @deprecated Packet handlers will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. */ +@Deprecated public interface PacketHandler { /** * Called when a registered packet has been seen. diff --git a/api/src/main/java/org/geysermc/floodgate/api/packet/PacketHandlers.java b/api/src/main/java/org/geysermc/floodgate/api/packet/PacketHandlers.java index e59c66fc..083b16c4 100644 --- a/api/src/main/java/org/geysermc/floodgate/api/packet/PacketHandlers.java +++ b/api/src/main/java/org/geysermc/floodgate/api/packet/PacketHandlers.java @@ -28,6 +28,11 @@ import io.netty.channel.ChannelHandlerContext; import org.geysermc.floodgate.api.util.TriFunction; +/** + * @deprecated Packet handlers will be removed with the launch of Floodgate 3.0. Please look at + * #536 for additional context. + */ +@Deprecated public interface PacketHandlers { /** * Register a specific class for a specific consumer.