From 20ff8711c0a34fd7ec36af9251336d8dd1b0a2b8 Mon Sep 17 00:00:00 2001 From: SirYwell Date: Sat, 27 Jan 2024 17:06:38 +0100 Subject: [PATCH] resolve some simple todos --- .../fastasyncworldedit/bukkit/FaweBukkit.java | 6 +++--- .../plotsquared/FaweDelegateRegionManager.java | 18 ++++++------------ .../sk89q/worldedit/bukkit/BukkitWorld.java | 4 ++-- .../util/progress/DefaultProgressTracker.java | 7 ++----- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java index e4283c2a6..77787dcd2 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java @@ -3,6 +3,7 @@ package com.fastasyncworldedit.bukkit; import com.fastasyncworldedit.bukkit.adapter.BukkitQueueHandler; import com.fastasyncworldedit.bukkit.adapter.NMSAdapter; import com.fastasyncworldedit.bukkit.listener.BrushListener; +import com.fastasyncworldedit.bukkit.listener.ChunkListener9; import com.fastasyncworldedit.bukkit.listener.RenderListener; import com.fastasyncworldedit.bukkit.regions.GriefDefenderFeature; import com.fastasyncworldedit.bukkit.regions.GriefPreventionFeature; @@ -93,10 +94,9 @@ public class FaweBukkit implements IFawe, Listener { //PlotSquared support is limited to Spigot/Paper as of 02/20/2020 TaskManager.taskManager().taskGlobal(this::setupPlotSquared); - // TODO (folia) moved out of task below?? Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin); // Registered delayed Event Listeners - /*TaskManager.taskManager().task(() -> { + TaskManager.taskManager().taskGlobal(() -> { // Fix for ProtocolSupport Settings.settings().PROTOCOL_SUPPORT_FIX = Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport"); @@ -105,7 +105,7 @@ public class FaweBukkit implements IFawe, Listener { // The tick limiter new ChunkListener9(); - });*/ + }); // Warn if small-edits are enabled with extended world heights if (version.isEqualOrHigherThan(MinecraftVersion.CAVES_18) && Settings.settings().HISTORY.SMALL_EDITS) { diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java index 412db0e3d..c795025ce 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java @@ -76,8 +76,7 @@ public class FaweDelegateRegionManager { e.printStackTrace(); } finally { if (whenDone != null) { - // TODO (folia) - // TaskManager.taskManager().task(whenDone, new com.sk89q.worldedit.util.Location(world, )); + com.plotsquared.core.util.task.TaskManager.runTask(whenDone); } } } @@ -204,8 +203,7 @@ public class FaweDelegateRegionManager { RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE) ); if (whenDone != null) { - // TODO (folia) - // TaskManager.taskManager().task(whenDone); + com.plotsquared.core.util.task.TaskManager.runTask(whenDone); } } }); @@ -274,8 +272,7 @@ public class FaweDelegateRegionManager { RelightMode.valueOf(com.fastasyncworldedit.core.configuration.Settings.settings().LIGHTING.MODE) ); if (whenDone != null) { - // TODO (folia) - // TaskManager.taskManager().task(whenDone); + com.plotsquared.core.util.task.TaskManager.runTask(whenDone); } } }); @@ -304,8 +301,7 @@ public class FaweDelegateRegionManager { e.printStackTrace(); } if (whenDone != null) { - // TODO (folia) - // TaskManager.taskManager().task(whenDone); + com.plotsquared.core.util.task.TaskManager.runTask(whenDone); } } }); @@ -358,8 +354,7 @@ public class FaweDelegateRegionManager { } } if (whenDone != null) { - // TODO (folia) - // TaskManager.taskManager().task(whenDone); + com.plotsquared.core.util.task.TaskManager.runTask(whenDone); } }); return true; @@ -383,8 +378,7 @@ public class FaweDelegateRegionManager { editSession.flushQueue(); } if (whenDone != null) { - // TODO (folia) - // TaskManager.taskManager().task(whenDone); + com.plotsquared.core.util.task.TaskManager.runTask(whenDone); } } }); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 031cdee81..f29a35b28 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -147,7 +147,7 @@ public class BukkitWorld extends AbstractWorld { public List getEntities(Region region) { World world = getWorld(); - List ents = List.of(); // TODO (folia) TaskManager.taskManager().sync(world::getEntities); + List ents = TaskManager.taskManager().syncGlobal(world::getEntities); List entities = new ArrayList<>(); for (Entity ent : ents) { if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) { @@ -161,7 +161,7 @@ public class BukkitWorld extends AbstractWorld { public List getEntities() { List list = new ArrayList<>(); - List ents = List.of(); // TaskManager.taskManager().sync(getWorld()::getEntities); + List ents = TaskManager.taskManager().syncGlobal(getWorld()::getEntities); for (Entity entity : ents) { list.add(BukkitAdapter.adapt(entity)); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/DefaultProgressTracker.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/DefaultProgressTracker.java index 7aab717f6..7708d246b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/DefaultProgressTracker.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/progress/DefaultProgressTracker.java @@ -92,16 +92,13 @@ public class DefaultProgressTracker implements BiConsumer