Skip to content

Commit

Permalink
Mark Floodgate API as deprecated. Removed handshake handlers, see #536
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim203 committed Sep 1, 2024
1 parent e719e83 commit cd96a0f
Show file tree
Hide file tree
Showing 26 changed files with 115 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
import org.geysermc.floodgate.api.player.FloodgatePlayer;
import org.geysermc.floodgate.api.unsafe.Unsafe;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public interface FloodgateApi {
/**
* Returns the Floodgate API instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,24 @@
import java.util.UUID;
import lombok.Getter;
import org.geysermc.floodgate.api.event.FloodgateEventBus;
import org.geysermc.floodgate.api.handshake.HandshakeHandlers;
import org.geysermc.floodgate.api.link.PlayerLink;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public final class InstanceHolder {
@Getter private static FloodgateApi api;
@Getter private static PlayerLink playerLink;
@Getter private static FloodgateEventBus eventBus;

@Getter private static HandshakeHandlers handshakeHandlers;
private static UUID storedKey;

public static boolean set(
FloodgateApi floodgateApi,
PlayerLink link,
FloodgateEventBus floodgateEventBus,
HandshakeHandlers handshakeHandlers,
UUID key
) {
if (storedKey != null) {
Expand All @@ -57,7 +59,6 @@ public static boolean set(
api = floodgateApi;
playerLink = link;
eventBus = floodgateEventBus;
InstanceHolder.handshakeHandlers = handshakeHandlers;
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@

import org.geysermc.event.bus.EventBus;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public interface FloodgateEventBus extends EventBus<Object, FloodgateSubscriber<?>> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@

import org.geysermc.event.subscribe.Subscriber;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public interface FloodgateSubscriber<T> extends Subscriber<T> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
import org.geysermc.floodgate.api.player.FloodgatePlayer;

/**
* An event that's fired when Floodgate receives a player skin. The event will be cancelled by
* default when hasSkin is true, as Floodgate by default only applies skins when the player has no
* skin applied yet.
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public interface SkinApplyEvent extends Cancellable {
/**
* Returns the player that will receive the skin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
import java.util.UUID;
import org.geysermc.floodgate.api.player.FloodgatePlayer;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public interface LinkRequest {
/**
* Returns the Java username of the linked player.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
package org.geysermc.floodgate.api.link;

/**
* This enum has all the available result types of both creating a player link request and
* validating it.
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public enum LinkRequestResult {
/**
* An unknown error encountered while creating / verifying the link request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import org.geysermc.floodgate.util.LinkedPlayer;

/**
* The base class of the PlayerLink database implementation. The implementation is responsible for
* making a connection with the database and keeping that connection alive so that Floodgate (or a
* third party plugin) can check for example if a given player is linked.
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public interface PlayerLink {
/**
* Called by Floodgate after the initialization of the class. In this method the implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
import org.geysermc.floodgate.util.LinkedPlayer;
import org.geysermc.floodgate.util.UiProfile;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public interface FloodgatePlayer {
/**
* Returns the Bedrock username that will be used as username on the server. This includes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@

import lombok.Getter;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
@Getter
@Deprecated
public class PropertyKey {
/**
* Socket Address returns the InetSocketAddress of the Bedrock player
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
import java.util.UUID;
import org.geysermc.floodgate.api.player.FloodgatePlayer;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public interface Unsafe {
/**
* Send a raw Bedrock packet to the given online Bedrock player.
Expand Down
16 changes: 3 additions & 13 deletions api/src/main/java/org/geysermc/floodgate/api/util/TriFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,10 @@
import java.util.function.Function;

/**
* Represents a function that accepts three arguments and produces a result. This is the three-arity
* specialization of {@link Function}.
*
* <p>This is a <a href="package-summary.html">functional interface</a>
* whose functional method is {@link #apply(Object, Object, Object)}.
*
* @param <T> the type of the first argument to the function
* @param <U> the type of the second argument to the function
* @param <V> the type of the third argument of the function
* @param <R> the type of the result of the function
* @see Function
* @since 1.8
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@FunctionalInterface
@Deprecated(forRemoval = true, since = "3.0.0")
public interface TriFunction<T, U, V, R> {
/**
* Performs this operation on the given arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
import lombok.RequiredArgsConstructor;

/**
* This class contains the raw data send by Geyser to Floodgate or from Floodgate to Floodgate. This
* class is only used internally, and you should look at FloodgatePlayer instead (FloodgatePlayer is
* present in the API module of the Floodgate repo)
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public final class BedrockData implements Cloneable {
Expand Down
6 changes: 5 additions & 1 deletion api/src/main/java/org/geysermc/floodgate/util/DeviceOs.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

@Deprecated
/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum DeviceOs {
UNKNOWN("Unknown"),
Expand Down
6 changes: 5 additions & 1 deletion api/src/main/java/org/geysermc/floodgate/util/InputMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@

package org.geysermc.floodgate.util;

@Deprecated
/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public enum InputMode {
UNKNOWN,
KEYBOARD_MOUSE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public final class LinkedPlayer implements Cloneable {
Expand Down
6 changes: 5 additions & 1 deletion api/src/main/java/org/geysermc/floodgate/util/UiProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@

package org.geysermc.floodgate.util;

@Deprecated
/**
* @deprecated The Floodgate API has been deprecated in favor of the GeyserApi, which is shared between Geyser
* and Floodgate
*/
@Deprecated(forRemoval = true, since = "3.0.0")
public enum UiProfile {
CLASSIC,
POCKET;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
// id("net.ltgt.errorprone")
id("net.kyori.indra")
id("net.kyori.indra.git")
id("floodgate.depsize")
}

dependencies {
Expand Down
29 changes: 29 additions & 0 deletions buildSrc/src/main/kotlin/floodgate.depsize.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Thanks to https://gist.github.com/medvedev/968119d7786966d9ed4442ae17aca279
tasks.register("depsize") {
description = "Prints dependencies for the \"runtimeClasspath\" configuration"
doLast {
listConfigurationDependencies(configurations["runtimeClasspath"])
}
}

fun listConfigurationDependencies(configuration: Configuration ) {
val formatStr = "%,10.2f"

val size = configuration.map { it.length() / (1024.0 * 1024.0) }.sum()

val out = StringBuffer()
out.append("\nConfiguration name: \"${configuration.name}\"\n")
if (size > 0) {
out.append("Total dependencies size:".padEnd(65))
out.append("${String.format(formatStr, size)} Mb\n\n")

configuration.sortedBy { -it.length() }
.forEach {
out.append(it.name.padEnd(65))
out.append("${String.format(formatStr, (it.length() / 1024.0))} kb\n")
}
} else {
out.append("No dependencies found")
}
println(out)
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.floodgate.api.InstanceHolder;
import org.geysermc.floodgate.api.event.FloodgateEventBus;
import org.geysermc.floodgate.api.handshake.HandshakeHandlers;
import org.geysermc.floodgate.core.api.inject.PlatformInjector;
import org.geysermc.floodgate.core.config.ConfigLoader;
import org.geysermc.floodgate.core.config.FloodgateConfig;
Expand Down Expand Up @@ -91,7 +90,6 @@ public void load() {
context.getBean(FloodgateApi.class),
null, // todo context.getBean(PlayerLink.class),
context.getBean(FloodgateEventBus.class),
context.getBean(HandshakeHandlers.class),
KEY
);
Geyser.set(api);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
import org.geysermc.floodgate.api.handshake.HandshakeData;
import org.geysermc.floodgate.core.api.handshake.HandshakeData;
import org.geysermc.floodgate.core.config.FloodgateConfig;
import org.geysermc.floodgate.core.connection.FloodgateConnection;
import org.geysermc.floodgate.core.connection.standalone.StandaloneFloodgateConnectionBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import jakarta.inject.Singleton;
import java.util.Random;
import org.geysermc.floodgate.api.handshake.HandshakeData;
import org.geysermc.floodgate.api.handshake.HandshakeHandler;
import org.geysermc.floodgate.api.handshake.HandshakeHandlers;
import org.geysermc.floodgate.core.api.handshake.HandshakeData;
import org.geysermc.floodgate.core.api.handshake.HandshakeHandler;
import org.geysermc.floodgate.core.api.handshake.HandshakeHandlers;

@Singleton
public class HandshakeHandlersImpl implements HandshakeHandlers {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Floodgate
*/

package org.geysermc.floodgate.api.handshake;
package org.geysermc.floodgate.core.api.handshake;

import java.util.UUID;
import org.geysermc.floodgate.util.BedrockData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Floodgate
*/

package org.geysermc.floodgate.api.handshake;
package org.geysermc.floodgate.core.api.handshake;

/**
* This class allows you to change and/or get specific data of the Bedrock client before Floodgate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @link https://github.com/GeyserMC/Floodgate
*/

package org.geysermc.floodgate.api.handshake;
package org.geysermc.floodgate.core.api.handshake;

/**
* @deprecated This system has been deprecated and will not be available in the new API that will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.util.UUID;
import org.geysermc.floodgate.api.handshake.HandshakeData;
import org.geysermc.floodgate.api.handshake.HandshakeHandler;
import org.geysermc.floodgate.api.handshake.HandshakeHandlers;
import org.geysermc.floodgate.core.api.handshake.HandshakeData;
import org.geysermc.floodgate.core.api.handshake.HandshakeHandler;
import org.geysermc.floodgate.core.api.handshake.HandshakeHandlers;
import org.geysermc.floodgate.core.logger.FloodgateLogger;
import org.geysermc.floodgate.util.BedrockData;

Expand Down

0 comments on commit cd96a0f

Please sign in to comment.