From 83ad5e24d9548c8959dcedc1e8b7dccc9e297978 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Tue, 7 Apr 2020 02:23:40 +0200 Subject: [PATCH] Make use of Spigot's Bukkit#unloadWorld(World, false) fix --- .../main/java/de/erethon/dungeonsxl/world/DEditWorld.java | 3 ++- .../main/java/de/erethon/dungeonsxl/world/DGameWorld.java | 3 ++- .../java/de/erethon/dungeonsxl/world/DResourceWorld.java | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DEditWorld.java b/core/src/main/java/de/erethon/dungeonsxl/world/DEditWorld.java index b6e8e28b..5e535fdc 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DEditWorld.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DEditWorld.java @@ -16,6 +16,7 @@ */ package de.erethon.dungeonsxl.world; +import de.erethon.commons.compatibility.Version; import de.erethon.commons.misc.FileUtil; import de.erethon.dungeonsxl.DungeonsXL; import de.erethon.dungeonsxl.api.world.EditWorld; @@ -119,7 +120,7 @@ public class DEditWorld extends DInstanceWorld implements EditWorld { FileUtil.copyDir(getFolder(), getResource().getFolder(), DungeonsXL.EXCLUDED_FILES); DResourceWorld.deleteUnusedFiles(getResource().getFolder()); if (!save) { - Bukkit.unloadWorld(getWorld(), true); + Bukkit.unloadWorld(getWorld(), /* SPIGOT-5225 */ !Version.isAtLeast(Version.MC1_14_4)); } FileUtil.removeDir(getFolder()); diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java b/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java index 37e8fa08..61d3877d 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DGameWorld.java @@ -19,6 +19,7 @@ package de.erethon.dungeonsxl.world; import de.erethon.caliburn.CaliburnAPI; import de.erethon.caliburn.item.ExItem; import de.erethon.caliburn.item.VanillaItem; +import de.erethon.commons.compatibility.Version; import de.erethon.commons.misc.BlockUtil; import de.erethon.commons.misc.FileUtil; import de.erethon.dungeonsxl.DungeonsXL; @@ -452,7 +453,7 @@ public class DGameWorld extends DInstanceWorld implements GameWorld { kickAllPlayers(); - Bukkit.unloadWorld(getWorld(), true); + Bukkit.unloadWorld(getWorld(), /* SPIGOT-5225 */ !Version.isAtLeast(Version.MC1_14_4)); FileUtil.removeDir(getFolder()); plugin.getInstanceCache().remove(this); } diff --git a/core/src/main/java/de/erethon/dungeonsxl/world/DResourceWorld.java b/core/src/main/java/de/erethon/dungeonsxl/world/DResourceWorld.java index a33b4986..081fd142 100644 --- a/core/src/main/java/de/erethon/dungeonsxl/world/DResourceWorld.java +++ b/core/src/main/java/de/erethon/dungeonsxl/world/DResourceWorld.java @@ -17,6 +17,7 @@ package de.erethon.dungeonsxl.world; import de.erethon.commons.chat.MessageUtil; +import de.erethon.commons.compatibility.Version; import de.erethon.commons.misc.FileUtil; import de.erethon.dungeonsxl.DungeonsXL; import de.erethon.dungeonsxl.api.dungeon.Dungeon; @@ -182,7 +183,7 @@ public class DResourceWorld implements ResourceWorld { World world = Bukkit.getWorld(name); boolean removed = false; if (world != null && world.getPlayers().isEmpty()) { - Bukkit.unloadWorld(name, false); + Bukkit.unloadWorld(name, /* SPIGOT-5225 */ !Version.isAtLeast(Version.MC1_14_4)); } if (world == null || world.getPlayers().isEmpty()) { removed = instanceFolder.delete(); @@ -316,7 +317,7 @@ public class DResourceWorld implements ResourceWorld { World world = rawCreator.createWorld(); File worldFolder = new File(Bukkit.getWorldContainer(), ".raw"); FileUtil.copyDir(worldFolder, RAW, DungeonsXL.EXCLUDED_FILES); - Bukkit.unloadWorld(world, false); + Bukkit.unloadWorld(world, /* SPIGOT-5225 */ !Version.isAtLeast(Version.MC1_14_4)); FileUtil.removeDir(worldFolder); }