Fix Asynchronous command dispatch! (PaperMC) (SD-7259)

Bukkit API calls need to be done syncronous. There are possibly some more async calls to the API that we didn't discover until now
This commit is contained in:
Christian Koop 2021-04-08 18:34:20 +02:00
parent c367287ffa
commit d9af9a06d8
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3

View File

@ -275,12 +275,14 @@ public class IslandManager {
Bukkit.getServer().getScheduler().runTaskLater(plugin, () ->
plugin.getBiomeManager().setBiome(island, IslandWorld.Normal, compatibleBiome, () -> {
if (structure.getCommands() != null) {
for (String commandList : structure.getCommands()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), commandList.replace("%player", player.getName()));
}
}
}), 20L);
if (structure.getCommands() != null) {
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
for (String commandList : structure.getCommands()) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), commandList.replace("%player", player.getName()));
}
});
}
}), 20L);
// Recalculate island level after 5 seconds
if (configLoad.getBoolean("Island.Levelling.ScanAutomatically"))