From effbacb823e2d41e83d180d9ee230378ec387750 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Mon, 30 Dec 2024 21:01:10 +0100 Subject: [PATCH] Force-enable NETWORK side effect to ensure blocks are instantly visible (#4558) --- .../bukkit/queue/BukkitQueueCoordinator.java | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java index 78749339c..d923fe679 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java @@ -62,19 +62,28 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { private static final SideEffectSet EDGE_LIGHTING_SIDE_EFFECT_SET; static { - NO_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.LIGHTING, SideEffect.State.OFF).with( - SideEffect.NEIGHBORS, - SideEffect.State.OFF - ); - EDGE_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.UPDATE, SideEffect.State.ON).with( - SideEffect.NEIGHBORS, - SideEffect.State.ON - ); - LIGHTING_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.NEIGHBORS, SideEffect.State.OFF); - EDGE_LIGHTING_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.UPDATE, SideEffect.State.ON).with( - SideEffect.NEIGHBORS, - SideEffect.State.ON - ); + NO_SIDE_EFFECT_SET = enableNetworkIfNeeded() + .with(SideEffect.LIGHTING, SideEffect.State.OFF) + .with(SideEffect.NEIGHBORS, SideEffect.State.OFF); + EDGE_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET + .with(SideEffect.UPDATE, SideEffect.State.ON) + .with(SideEffect.NEIGHBORS, SideEffect.State.ON); + LIGHTING_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET + .with(SideEffect.NEIGHBORS, SideEffect.State.OFF); + EDGE_LIGHTING_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET + .with(SideEffect.UPDATE, SideEffect.State.ON) + .with(SideEffect.NEIGHBORS, SideEffect.State.ON); + } + + // make sure block changes are sent + private static SideEffectSet enableNetworkIfNeeded() { + SideEffect network; + try { + network = SideEffect.valueOf("NETWORK"); + } catch (IllegalArgumentException ignored) { + return SideEffectSet.none(); + } + return SideEffectSet.none().with(network, SideEffect.State.ON); } private org.bukkit.World bukkitWorld;