1
0
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:
Aurorawr
2025-09-30 19:14:35 +01:00
committed by GitHub
parent 40d320a619
commit d5be877ed9
4 changed files with 21 additions and 7 deletions

View File

@@ -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);

View File

@@ -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
}
}