Skip to content

Commit 7ff8c18

Browse files
Reworking event listener for Weaving effect
1 parent 8ad90b0 commit 7ff8c18

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

Bukkit/src/main/java/com/plotsquared/bukkit/listener/EntityEventListener.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -244,24 +244,21 @@ public void onWeavingEffect(EntityChangeBlockEvent event) {
244244
if (event.getTo() != Material.COBWEB) {
245245
return;
246246
}
247-
Block block = event.getBlock();
248-
World world = block.getWorld();
249-
String worldName = world.getName();
250-
if (!this.plotAreaManager.hasPlotArea(worldName)) {
251-
return;
252-
}
253-
Location location = BukkitUtil.adapt(block.getLocation());
247+
Location location = BukkitUtil.adapt(event.getBlock().getLocation());
254248
PlotArea area = location.getPlotArea();
255249
if (area == null) {
256250
return;
257251
}
258-
Plot plot = area.getOwnedPlotAbs(location);
259-
260-
if (plot == null || !plot.getFlag(WeavingDeathPlace.class)) {
261-
event.setCancelled(true);
262-
if (plot != null) {
263-
plot.debug("Falling block event was cancelled because weaving-death-place = false");
252+
Plot plot = location.getOwnedPlot();
253+
if (plot == null) {
254+
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, WeavingDeathPlace.class, false)) {
255+
event.setCancelled(true);
264256
}
257+
return;
258+
}
259+
if (plot.getFlag(WeavingDeathPlace.class)) {
260+
plot.debug(event.getTo() + " could not spawn because weaving-death-place = false");
261+
event.setCancelled(true);
265262
}
266263
}
267264

0 commit comments

Comments
 (0)