Skip to content

Commit

Permalink
Reworking event listener for Weaving effect
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneFuture committed Oct 12, 2024
1 parent 8ad90b0 commit 7ff8c18
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,24 +244,21 @@ public void onWeavingEffect(EntityChangeBlockEvent event) {
if (event.getTo() != Material.COBWEB) {
return;
}
Block block = event.getBlock();
World world = block.getWorld();
String worldName = world.getName();
if (!this.plotAreaManager.hasPlotArea(worldName)) {
return;
}
Location location = BukkitUtil.adapt(block.getLocation());
Location location = BukkitUtil.adapt(event.getBlock().getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Plot plot = area.getOwnedPlotAbs(location);

if (plot == null || !plot.getFlag(WeavingDeathPlace.class)) {
event.setCancelled(true);
if (plot != null) {
plot.debug("Falling block event was cancelled because weaving-death-place = false");
Plot plot = location.getOwnedPlot();
if (plot == null) {
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, WeavingDeathPlace.class, false)) {
event.setCancelled(true);
}
return;
}
if (plot.getFlag(WeavingDeathPlace.class)) {
plot.debug(event.getTo() + " could not spawn because weaving-death-place = false");
event.setCancelled(true);
}
}

Expand Down

0 comments on commit 7ff8c18

Please sign in to comment.