diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 5b294ea27..ce357a5ab 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -27,14 +27,12 @@ body: description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first. multiple: false options: + - '1.19' - '1.18.2' - '1.18.1' - '1.18' - '1.17.1' - '1.16.5' - - '1.15.2' - - '1.14.4' - - '1.13.2' validations: required: true diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java index 32d210c6e..908c95a21 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java @@ -150,7 +150,11 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap } // Extracted to synchronized method for thread-safety, preventing multiple internal world load calls - private synchronized void checkLoaded(World world) { + private synchronized void checkLoaded(@NonNull World world) { + // Do not attempt to load configurations until WorldEdit has a platform ready. + if (!PlotSquared.get().isWeInitialised()) { + return; + } if (!this.loaded) { String name = world.getName(); PlotSquared.get().loadWorld(name, this); @@ -172,11 +176,11 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap } @SuppressWarnings("deprecation") // Kept for compatibility with <=1.17.1 - private void setSpawnLimits(World world, int spawnLimit) { - world.setAmbientSpawnLimit(spawnLimit); - world.setAnimalSpawnLimit(spawnLimit); - world.setMonsterSpawnLimit(spawnLimit); - world.setWaterAnimalSpawnLimit(spawnLimit); + private void setSpawnLimits(@NonNull World world, int limit) { + world.setAmbientSpawnLimit(limit); + world.setAnimalSpawnLimit(limit); + world.setMonsterSpawnLimit(limit); + world.setWaterAnimalSpawnLimit(limit); } @Override @@ -323,6 +327,11 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap } private void generate(BlockVector2 loc, String world, ZeroedDelegateScopedQueueCoordinator result, boolean biomes) { + if (!this.loaded) { + synchronized (this) { + PlotSquared.get().loadWorld(world, this); + } + } // Process the chunk if (ChunkManager.preProcessChunk(loc, result)) { return; diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java index bd4c485f4..b8a052bc5 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java @@ -208,7 +208,7 @@ public class EntityEventListener implements Listener { } return; } - if (BukkitEntityUtil.checkEntity(entity, plot)) { + if (BukkitEntityUtil.checkEntity(entity, plot.getBasePlot(false))) { event.setCancelled(true); } } diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 3885bd399..aab061cd9 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -72,7 +72,10 @@ import com.plotsquared.core.util.ReflectionUtils; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.uuid.UUIDPipeline; import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.event.platform.PlatformReadyEvent; import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.util.eventbus.EventHandler; +import com.sk89q.worldedit.util.eventbus.Subscribe; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; @@ -153,6 +156,8 @@ public class PlotSquared { private EventDispatcher eventDispatcher; private PlotListener plotListener; + private boolean weInitialised; + /** * Initialize PlotSquared with the desired Implementation class. * @@ -223,6 +228,7 @@ public class PlotSquared { } this.worldedit = WorldEdit.getInstance(); + WorldEdit.getInstance().getEventBus().register(new WEPlatformReadyListener()); // Create Event utility class this.eventDispatcher = new EventDispatcher(this.worldedit); @@ -1576,6 +1582,13 @@ public class PlotSquared { return this.plotListener; } + /** + * Get if the {@link PlatformReadyEvent} has been sent by WE. There is no way to query this within WE itself. + */ + public boolean isWeInitialised() { + return weInitialised; + } + /** * Different ways of sorting {@link Plot plots} */ @@ -1598,4 +1611,15 @@ public class PlotSquared { DISTANCE_FROM_ORIGIN } + private final class WEPlatformReadyListener { + + @SuppressWarnings("unused") + @Subscribe(priority = EventHandler.Priority.VERY_EARLY) + public void onPlatformReady(PlatformReadyEvent event) { + weInitialised = true; + WorldEdit.getInstance().getEventBus().unregister(WEPlatformReadyListener.this); + } + + } + } diff --git a/build.gradle.kts b/build.gradle.kts index 46f3b0f8d..0a8cacfe5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -66,7 +66,7 @@ subprojects { } dependencies { - implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.2")) + implementation(platform("com.intellectualsites.bom:bom-newest:1.5")) } }