mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
Restriction: Adding "weaving-death-place" flag (#4519)
* Adding "weaving-death-place" flag * Improving spelling of flag description * Reworking event listener for Weaving effect * Undoing import optimization * Fixing weaving-death-place check for plots
This commit is contained in:
@ -37,6 +37,7 @@ import com.plotsquared.core.plot.flag.implementations.EntityChangeBlockFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ExplosionFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ProjectileChangeBlockFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.WeavingDeathPlace;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.PlotFlagUtil;
|
||||
@ -243,6 +244,29 @@ public class EntityEventListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onWeavingEffect(EntityChangeBlockEvent event) {
|
||||
if (event.getTo() != Material.COBWEB) {
|
||||
return;
|
||||
}
|
||||
Location location = BukkitUtil.adapt(event.getBlock().getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onDamage(EntityDamageEvent event) {
|
||||
if (event.getEntityType() != EntityType.PLAYER) {
|
||||
|
Reference in New Issue
Block a user