mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 22:26:45 +01:00
- Add break statements to switches to prevent bleed from normal spawning to breeding - Separate misc spawning from mob spawning
This commit is contained in:
parent
ab121c7eee
commit
e2f9b4245b
@ -146,6 +146,7 @@ public class EntityEventListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case "BREEDING":
|
case "BREEDING":
|
||||||
if (!area.isSpawnBreeding()) {
|
if (!area.isSpawnBreeding()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -58,12 +58,11 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class EntitySpawnListener implements Listener {
|
public class EntitySpawnListener implements Listener {
|
||||||
|
|
||||||
private final static String KEY = "P2";
|
private final static String KEY = "P2";
|
||||||
private static boolean ignoreTP = false;
|
private static boolean ignoreTP = false;
|
||||||
private static boolean hasPlotArea = false;
|
|
||||||
private static String areaName = null;
|
|
||||||
|
|
||||||
public static void testNether(final Entity entity) {
|
public static void testNether(final Entity entity) {
|
||||||
@NotNull World world = entity.getWorld();
|
@NotNull World world = entity.getWorld();
|
||||||
@ -76,12 +75,7 @@ public class EntitySpawnListener implements Listener {
|
|||||||
|
|
||||||
public static void testCreate(final Entity entity) {
|
public static void testCreate(final Entity entity) {
|
||||||
@NotNull World world = entity.getWorld();
|
@NotNull World world = entity.getWorld();
|
||||||
if (areaName == world.getName()) {
|
if (!PlotSquared.get().hasPlotArea(entity.getWorld().getName())) {
|
||||||
} else {
|
|
||||||
areaName = world.getName();
|
|
||||||
hasPlotArea = PlotSquared.get().hasPlotArea(areaName);
|
|
||||||
}
|
|
||||||
if (!hasPlotArea) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
test(entity);
|
test(entity);
|
||||||
@ -134,21 +128,24 @@ public class EntitySpawnListener implements Listener {
|
|||||||
}
|
}
|
||||||
Plot plot = location.getOwnedPlotAbs();
|
Plot plot = location.getOwnedPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
if (!area.isMobSpawning()) {
|
|
||||||
EntityType type = entity.getType();
|
EntityType type = entity.getType();
|
||||||
|
if (!area.isMobSpawning()) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DROPPED_ITEM:
|
case DROPPED_ITEM:
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
case PLAYER:
|
case PLAYER:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type.isAlive() || !area.isMiscSpawnUnowned()) {
|
if (type.isAlive()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!area.isMiscSpawnUnowned() && !type.isAlive()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
|
@ -193,6 +193,7 @@ public class PaperListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case "BREEDING":
|
case "BREEDING":
|
||||||
if (!area.isSpawnBreeding()) {
|
if (!area.isSpawnBreeding()) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user