diff --git a/build-logic/src/main/kotlin/extensions.kt b/build-logic/src/main/kotlin/extensions.kt index 11406872..57d23b29 100644 --- a/build-logic/src/main/kotlin/extensions.kt +++ b/build-logic/src/main/kotlin/extensions.kt @@ -26,6 +26,7 @@ import net.kyori.indra.git.IndraGitExtension import org.gradle.api.Project import org.gradle.api.artifacts.ProjectDependency +import org.gradle.kotlin.dsl.add import org.gradle.kotlin.dsl.the fun Project.fullVersion(): String { @@ -57,13 +58,15 @@ fun buildNumberAsString(): String = val providedDependencies = mutableMapOf>>() val relocatedPackages = mutableMapOf>() -fun Project.provided(pattern: String, name: String, version: String, excludedOn: Int = 0b110) { +fun Project.provided(pattern: String, name: String, version: String, excludedOn: Int = 0b110, includeTransitiveDeps: Boolean = true) { val format = "${calcExclusion(pattern, 0b100, excludedOn)}:" + "${calcExclusion(name, 0b10, excludedOn)}:" + calcExclusion(version, 0b1, excludedOn) providedDependencies.getOrPut(project.name) { mutableSetOf() }.add(Pair(format, format)) - dependencies.add("compileOnlyApi", "$pattern:$name:$version") + dependencies.add("compileOnlyApi", "$pattern:$name:$version") { + isTransitive = includeTransitiveDeps + } } fun Project.provided(dependency: ProjectDependency) { diff --git a/bungee/build.gradle.kts b/bungee/build.gradle.kts index 711d7a71..e5290f59 100644 --- a/bungee/build.gradle.kts +++ b/bungee/build.gradle.kts @@ -1,4 +1,5 @@ -var bungeeVersion = "1.21-R0.1-SNAPSHOT" +var bungeeProxyVersion = "1.21-R0.1-SNAPSHOT" +var bungeeApiVersion = "1.21-R0.1" var gsonVersion = "2.8.0" var guavaVersion = "21.0" @@ -16,6 +17,7 @@ relocate("io.leangen.geantyref") relocate("org.yaml") // these dependencies are already present on the platform -provided("net.md-5", "bungeecord-proxy", bungeeVersion) +provided("net.md-5", "bungeecord-proxy", bungeeProxyVersion, includeTransitiveDeps = false) +provided("net.md-5", "bungeecord-api", bungeeApiVersion) provided("com.google.code.gson", "gson", gsonVersion) provided("com.google.guava", "guava", guavaVersion) diff --git a/spigot/src/main/java/org/geysermc/floodgate/util/SpigotVersionSpecificMethods.java b/spigot/src/main/java/org/geysermc/floodgate/util/SpigotVersionSpecificMethods.java index 7569c615..21457ef4 100644 --- a/spigot/src/main/java/org/geysermc/floodgate/util/SpigotVersionSpecificMethods.java +++ b/spigot/src/main/java/org/geysermc/floodgate/util/SpigotVersionSpecificMethods.java @@ -122,10 +122,19 @@ public final class SpigotVersionSpecificMethods { } public void maybeSchedule(Runnable runnable) { - // In Folia we don't have to schedule this as there is no concept of a single main thread. + this.maybeSchedule(runnable, false); + } + + public void maybeSchedule(Runnable runnable, boolean globalContext) { + // In Folia we don't usually have to schedule this as there is no concept of a single main thread. // Instead, we have to schedule the task per player. + // However, in some cases we may want to access the global region for a global context. if (ClassNames.IS_FOLIA) { - runnable.run(); + if (globalContext) { + plugin.getServer().getGlobalRegionScheduler().run(plugin, (task) -> runnable.run()); + } else { + runnable.run(); + } return; } plugin.getServer().getScheduler().runTask(plugin, runnable); diff --git a/spigot/src/main/java/org/geysermc/floodgate/util/WhitelistUtils.java b/spigot/src/main/java/org/geysermc/floodgate/util/WhitelistUtils.java index d5779565..3e675d64 100644 --- a/spigot/src/main/java/org/geysermc/floodgate/util/WhitelistUtils.java +++ b/spigot/src/main/java/org/geysermc/floodgate/util/WhitelistUtils.java @@ -79,6 +79,6 @@ public final class WhitelistUtils { } static void setWhitelist(OfflinePlayer player, boolean whitelist, SpigotVersionSpecificMethods versionSpecificMethods) { - versionSpecificMethods.maybeSchedule(() -> player.setWhitelisted(whitelist)); + versionSpecificMethods.maybeSchedule(() -> player.setWhitelisted(whitelist), true); // Whitelisting is on the global thread } }