mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00: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
3 changed files with 10 additions and 11 deletions
|
@ -146,6 +146,7 @@ public class EntityEventListener implements Listener {
|
|||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "BREEDING":
|
||||
if (!area.isSpawnBreeding()) {
|
||||
event.setCancelled(true);
|
||||
|
|
|
@ -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) {
|
||||
if (!area.isMobSpawning()) {
|
||||
EntityType type = entity.getType();
|
||||
if (!area.isMobSpawning()) {
|
||||
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)) {
|
||||
|
|
|
@ -193,6 +193,7 @@ public class PaperListener implements Listener {
|
|||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "BREEDING":
|
||||
if (!area.isSpawnBreeding()) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
|
|
Loading…
Reference in a new issue