- Add break statements to switches to prevent bleed from normal spawning to breeding
 - Separate misc spawning from mob spawning
This commit is contained in:
dordsor21 2020-07-28 13:56:37 +01:00
parent ab121c7eee
commit e2f9b4245b
No known key found for this signature in database
GPG key ID: 1E53E88969FFCF0B
3 changed files with 10 additions and 11 deletions

View file

@ -146,6 +146,7 @@ public class EntityEventListener implements Listener {
event.setCancelled(true);
return;
}
break;
case "BREEDING":
if (!area.isSpawnBreeding()) {
event.setCancelled(true);

View file

@ -58,12 +58,11 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
@SuppressWarnings("unused")
public class EntitySpawnListener implements Listener {
private final static String KEY = "P2";
private static boolean ignoreTP = false;
private static boolean hasPlotArea = false;
private static String areaName = null;
public static void testNether(final Entity entity) {
@NotNull World world = entity.getWorld();
@ -76,12 +75,7 @@ public class EntitySpawnListener implements Listener {
public static void testCreate(final Entity entity) {
@NotNull World world = entity.getWorld();
if (areaName == world.getName()) {
} else {
areaName = world.getName();
hasPlotArea = PlotSquared.get().hasPlotArea(areaName);
}
if (!hasPlotArea) {
if (!PlotSquared.get().hasPlotArea(entity.getWorld().getName())) {
return;
}
test(entity);
@ -134,21 +128,24 @@ public class EntitySpawnListener implements Listener {
}
Plot plot = location.getOwnedPlotAbs();
if (plot == null) {
EntityType type = entity.getType();
if (!area.isMobSpawning()) {
EntityType type = entity.getType();
switch (type) {
case DROPPED_ITEM:
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true);
break;
return;
}
case PLAYER:
return;
}
if (type.isAlive() || !area.isMiscSpawnUnowned()) {
if (type.isAlive()) {
event.setCancelled(true);
}
}
if (!area.isMiscSpawnUnowned() && !type.isAlive()) {
event.setCancelled(true);
}
return;
}
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {

View file

@ -193,6 +193,7 @@ public class PaperListener implements Listener {
event.setCancelled(true);
return;
}
break;
case "BREEDING":
if (!area.isSpawnBreeding()) {
event.setShouldAbortSpawn(true);