This commit is contained in:
Jesse Boyd 2018-05-17 14:53:34 +10:00
parent 98b7a84119
commit 9f9527d2e2
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 8 additions and 5 deletions

View File

@ -927,13 +927,15 @@ public class PlayerEvents extends PlotListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPeskyMobsChangeTheWorldLikeWTFEvent(EntityChangeBlockEvent event) { public void onPeskyMobsChangeTheWorldLikeWTFEvent(EntityChangeBlockEvent event) {
String world = event.getBlock().getWorld().getName();
if (!PS.get().hasPlotArea(world)) {
return;
}
Entity e = event.getEntity(); Entity e = event.getEntity();
if (!(e instanceof FallingBlock)) { if (!(e instanceof FallingBlock)) {
event.setCancelled(true); Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
PlotArea area = location.getPlotArea();
if (area != null) {
Plot plot = area.getOwnedPlot(location);
if (plot != null && Flags.MOB_BREAK.isTrue(plot)) return;
event.setCancelled(true);
}
} }
} }

View File

@ -80,6 +80,7 @@ public final class Flags {
public static final BooleanFlag HOSTILE_ATTACK = new BooleanFlag("hostile-attack"); public static final BooleanFlag HOSTILE_ATTACK = new BooleanFlag("hostile-attack");
public static final BooleanFlag HOSTILE_INTERACT = new BooleanFlag("hostile-interact"); public static final BooleanFlag HOSTILE_INTERACT = new BooleanFlag("hostile-interact");
public static final BooleanFlag MOB_PLACE = new BooleanFlag("mob-place"); public static final BooleanFlag MOB_PLACE = new BooleanFlag("mob-place");
public static final BooleanFlag MOB_BREAK = new BooleanFlag("mob-break");
public static final BooleanFlag FORCEFIELD = new BooleanFlag("forcefield"); public static final BooleanFlag FORCEFIELD = new BooleanFlag("forcefield");
public static final BooleanFlag INVINCIBLE = new BooleanFlag("invincible"); public static final BooleanFlag INVINCIBLE = new BooleanFlag("invincible");
public static final BooleanFlag ITEM_DROP = new BooleanFlag("item-drop"); public static final BooleanFlag ITEM_DROP = new BooleanFlag("item-drop");