From d9af9a06d80e06f1c7b630d92ea0408765c0e97f Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Thu, 8 Apr 2021 18:34:20 +0200 Subject: [PATCH] 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 --- .../com/songoda/skyblock/island/IslandManager.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/island/IslandManager.java b/src/main/java/com/songoda/skyblock/island/IslandManager.java index c92ba7eb..0480bb92 100644 --- a/src/main/java/com/songoda/skyblock/island/IslandManager.java +++ b/src/main/java/com/songoda/skyblock/island/IslandManager.java @@ -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"))