Skip to content

Commit 49fca1c

Browse files
committed
Force-enable NETWORK side effect to ensure blocks are instantly visible
1 parent 960b7b2 commit 49fca1c

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

Bukkit/src/main/java/com/plotsquared/bukkit/queue/BukkitQueueCoordinator.java

+22-13
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,28 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
6262
private static final SideEffectSet EDGE_LIGHTING_SIDE_EFFECT_SET;
6363

6464
static {
65-
NO_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.LIGHTING, SideEffect.State.OFF).with(
66-
SideEffect.NEIGHBORS,
67-
SideEffect.State.OFF
68-
);
69-
EDGE_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.UPDATE, SideEffect.State.ON).with(
70-
SideEffect.NEIGHBORS,
71-
SideEffect.State.ON
72-
);
73-
LIGHTING_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.NEIGHBORS, SideEffect.State.OFF);
74-
EDGE_LIGHTING_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.UPDATE, SideEffect.State.ON).with(
75-
SideEffect.NEIGHBORS,
76-
SideEffect.State.ON
77-
);
65+
NO_SIDE_EFFECT_SET = enableNetworkIfNeeded()
66+
.with(SideEffect.LIGHTING, SideEffect.State.OFF)
67+
.with(SideEffect.NEIGHBORS, SideEffect.State.OFF);
68+
EDGE_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET
69+
.with(SideEffect.UPDATE, SideEffect.State.ON)
70+
.with(SideEffect.NEIGHBORS, SideEffect.State.ON);
71+
LIGHTING_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET
72+
.with(SideEffect.NEIGHBORS, SideEffect.State.OFF);
73+
EDGE_LIGHTING_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET
74+
.with(SideEffect.UPDATE, SideEffect.State.ON)
75+
.with(SideEffect.NEIGHBORS, SideEffect.State.ON);
76+
}
77+
78+
// make sure block changes are sent
79+
private static SideEffectSet enableNetworkIfNeeded() {
80+
SideEffect network;
81+
try {
82+
network = SideEffect.valueOf("NETWORK");
83+
} catch (IllegalArgumentException ignored) {
84+
return SideEffectSet.none();
85+
}
86+
return SideEffectSet.none().with(network, SideEffect.State.ON);
7887
}
7988

8089
private org.bukkit.World bukkitWorld;

0 commit comments

Comments
 (0)