mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2025-12-19 14:59:20 +00:00
Fix fwhitelist command + Bungee build fix (#613)
This commit is contained in:
@@ -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<String, MutableSet<Pair<String, Any>>>()
|
||||
val relocatedPackages = mutableMapOf<String, MutableSet<String>>()
|
||||
|
||||
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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
if (globalContext) {
|
||||
plugin.getServer().getGlobalRegionScheduler().run(plugin, (task) -> runnable.run());
|
||||
} else {
|
||||
runnable.run();
|
||||
}
|
||||
return;
|
||||
}
|
||||
plugin.getServer().getScheduler().runTask(plugin, runnable);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user