1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-29 19:49:14 +00:00

Updated Gradle, Micronaut and fixed Folia detection

This commit is contained in:
Tim203
2023-08-13 23:59:18 +02:00
parent ba800542f6
commit 16360a3bd6
18 changed files with 39 additions and 43 deletions

View File

@@ -34,11 +34,6 @@ tasks {
// for example Velocity, the relocation will be gone for Velocity)
addRelocations(project, sJar)
}
val destinationDir = System.getenv("DESTINATION_DIRECTORY");
if (destinationDir != null) {
destinationDirectory = file(destinationDir)
}
}
named("build") {

View File

@@ -1,6 +1,7 @@
dependencies {
api(projects.core)
annotationProcessor(projects.core)
annotationProcessor(libs.micronaut.inject.java)
compileOnlyApi(projects.isolation)
implementation(libs.cloud.bungee)
@@ -8,8 +9,7 @@ dependencies {
relocate("net.kyori")
relocate("cloud.commandframework")
// used in cloud
relocate("io.leangen.geantyref")
relocate("io.leangen.geantyref") // used in cloud
// these dependencies are already present on the platform
provided(libs.bungee)

View File

@@ -34,7 +34,6 @@ import jakarta.inject.Inject;
import jakarta.inject.Singleton;
import java.util.UUID;
import lombok.Getter;
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.floodgate.api.logger.FloodgateLogger;
import org.geysermc.floodgate.core.command.util.Permission;
import org.geysermc.floodgate.core.config.FloodgateConfig;
@@ -50,7 +49,6 @@ import org.geysermc.floodgate.core.player.audience.ProfileAudienceArgument;
@Singleton
public class WhitelistCommand implements FloodgateCommand {
@Inject FloodgateApi api;
@Inject FloodgateConfig config;
@Inject XboxClient xboxClient;
@Inject FloodgateLogger logger;

View File

@@ -31,7 +31,7 @@ import java.util.concurrent.CompletableFuture;
import lombok.AccessLevel;
import lombok.Getter;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.floodgate.api.FloodgateApi;
import org.geysermc.api.GeyserApiBase;
import org.geysermc.floodgate.api.logger.FloodgateLogger;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
import org.geysermc.floodgate.core.config.FloodgateConfig;
@@ -49,7 +49,7 @@ public abstract class CommonPlayerLink {
@Inject
@Getter(AccessLevel.PROTECTED)
FloodgateApi api;
GeyserApiBase api;
@Inject
public void commonInit(FloodgateConfig config) {
@@ -68,10 +68,10 @@ public abstract class CommonPlayerLink {
* @return true if the given player is the player requested
*/
public boolean isRequestedPlayer(LinkRequest request, UUID bedrockId) {
// Java starts the process, Bedrock finishes it. So player can't be null
var player = api.getPlayer(bedrockId);
return request.bedrockUsername().equals(player.getUsername()) ||
request.bedrockUsername().equals(player.getJavaUsername());
var player = api.connectionByUuid(bedrockId);
//noinspection ConstantConditions Java starts the process, Bedrock finishes it. So player can't be null
return request.bedrockUsername().equals(player.bedrockUsername()) ||
request.bedrockUsername().equals(player.javaUsername());
}
public abstract CompletableFuture<LinkedPlayer> addLink(

View File

@@ -39,6 +39,8 @@ import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import jakarta.inject.Singleton;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -60,6 +62,7 @@ import org.geysermc.floodgate.core.util.Utils;
import org.geysermc.floodgate.util.BedrockData;
import org.geysermc.floodgate.util.LinkedPlayer;
@Singleton
public final class FloodgateHandshakeHandler {
@Inject ConnectionManager connectionManager;
@Inject HandshakeHandlersImpl handshakeHandlers;

View File

@@ -4,4 +4,4 @@ org.gradle.parallel=true
systemProp.org.gradle.unsafe.kotlin.assignment=true
version=2.2.2-SNAPSHOT
micronautVersion=4.0.0-M5
micronautVersion=4.0.3

View File

@@ -1,6 +1,6 @@
[versions]
# parent
micronaut-gradle = "4.0.0-M8"
micronaut-gradle = "4.0.2"
lombok = "8.0.1"
# api
@@ -22,7 +22,7 @@ bstats = "3.0.2"
bungee = "master-SNAPSHOT"
# spigot
folia = "1.19.4-R0.1-SNAPSHOT"
paper = "1.20.1-R0.1-SNAPSHOT"
authlib = "1.5.21"
# velocity
@@ -80,7 +80,7 @@ bungee = { module = "com.github.SpigotMC.BungeeCord:bungeecord-proxy", version.r
cloud-bungee = { module = "cloud.commandframework:cloud-bungee", version.ref = "cloud" }
# spigot
folia-api = { module = "dev.folia:folia-api", version.ref = "folia" }
paper-api = { module = "io.papermc.paper:paper-api", version.ref = "paper" }
cloud-bukkit = { module = "cloud.commandframework:cloud-bukkit", version.ref = "cloud" }
authlib = { module = "com.mojang:authlib", version.ref = "authlib" }

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

7
gradlew vendored
View File

@@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in

View File

@@ -1,11 +1,12 @@
dependencies {
api(projects.core)
annotationProcessor(projects.core)
annotationProcessor(libs.micronaut.inject.java)
compileOnlyApi(projects.isolation)
implementation(libs.cloud.bukkit)
compileOnlyApi(libs.folia.api)
compileOnlyApi(libs.paper.api)
}
relocate("net.kyori")

View File

@@ -43,17 +43,6 @@ public class SpigotPlatform extends FloodgatePlatform {
this.plugin = plugin;
}
@Override
public void enable() throws RuntimeException {
super.enable();
// add ProtocolSupport support (hack)
if (plugin.getServer().getPluginManager().getPlugin("ProtocolSupport") != null) {
context.getBean(SpigotProtocolSupportHandler.class);
SpigotProtocolSupportListener.registerHack(plugin);
}
}
@Override
protected void onContextCreated(ApplicationContext context) {
context.registerSingleton(plugin)
@@ -67,6 +56,17 @@ public class SpigotPlatform extends FloodgatePlatform {
this.context = context;
}
@Override
public void enable() throws RuntimeException {
super.enable();
// add ProtocolSupport support (hack)
if (plugin.getServer().getPluginManager().getPlugin("ProtocolSupport") != null) {
context.getBean(SpigotProtocolSupportHandler.class);
SpigotProtocolSupportListener.registerHack(plugin);
}
}
@Override
protected boolean isProxy() {
return false;

View File

@@ -228,7 +228,7 @@ public class ClassNames {
}
IS_FOLIA = ReflectionUtils.getClassSilently(
"io.papermc.paper.threadedregions.scheduler.EntityScheduler"
"io.papermc.paper.threadedregions.RegionizedServer"
) != null;
}

View File

@@ -30,7 +30,7 @@ import org.bukkit.Bukkit;
import org.geysermc.floodgate.core.platform.util.PlatformUtils;
@Singleton
public class SpigotPlatformUtils extends PlatformUtils {
public final class SpigotPlatformUtils extends PlatformUtils {
@Override
public AuthType authType() {
if (Bukkit.getOnlineMode()) {

View File

@@ -4,7 +4,7 @@ plugins {
dependencies {
api(projects.isolation)
compileOnlyApi(libs.folia.api)
compileOnlyApi(libs.paper.api)
}
tasks {

View File

@@ -3,7 +3,7 @@ plugins {
}
provided(libs.bungee)
provided(libs.folia.api)
provided(libs.paper.api)
provided(libs.velocity.api)
// todo use an isolated class loader in the future

View File

@@ -10,12 +10,10 @@ dependencies {
}
relocate("cloud.commandframework")
// used in cloud
relocate("io.leangen.geantyref")
relocate("io.leangen.geantyref") // used in cloud
relocate("org.yaml.snakeyaml")
// these dependencies are already present on the platform
provided(libs.gson)
provided(libs.velocity.api)