mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
fix: re-add default spawn option and disclude armour stands (#4240)
- Fixes #4238
This commit is contained in:
parent
eb63e4351d
commit
cdb44d4884
@ -143,6 +143,10 @@ public class EntityEventListener implements Listener {
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
// Armour-stands are handled elsewhere and should not be handled by area-wide entity-spawn options
|
||||
if (entity.getType() == EntityType.ARMOR_STAND) {
|
||||
return;
|
||||
}
|
||||
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
|
||||
switch (reason.toString()) {
|
||||
case "DISPENSE_EGG", "EGG", "OCELOT_BABY", "SPAWNER_EGG" -> {
|
||||
@ -153,7 +157,7 @@ public class EntityEventListener implements Listener {
|
||||
}
|
||||
case "REINFORCEMENTS", "NATURAL", "MOUNT", "PATROL", "RAID", "SHEARED", "SILVERFISH_BLOCK", "ENDER_PEARL",
|
||||
"TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN", "NETHER_PORTAL",
|
||||
"DUPLICATION", "FROZEN", "SPELL" -> {
|
||||
"DUPLICATION", "FROZEN", "SPELL", "DEFAULT" -> {
|
||||
if (!area.isMobSpawning()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -166,7 +170,7 @@ public class EntityEventListener implements Listener {
|
||||
}
|
||||
}
|
||||
case "BUILD_IRONGOLEM", "BUILD_SNOWMAN", "BUILD_WITHER", "CUSTOM" -> {
|
||||
if (!area.isSpawnCustom() && entity.getType() != EntityType.ARMOR_STAND) {
|
||||
if (!area.isSpawnCustom()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class PaperListener implements Listener {
|
||||
}
|
||||
Slime slime = event.getEntity();
|
||||
|
||||
Block b = slime.getTargetBlock(4);
|
||||
Block b = slime.getTargetBlockExact(4);
|
||||
if (b == null) {
|
||||
return;
|
||||
}
|
||||
@ -166,12 +166,16 @@ public class PaperListener implements Listener {
|
||||
}
|
||||
Location location = BukkitUtil.adapt(event.getSpawnLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (!location.isPlotArea()) {
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
//If entities are spawning... the chunk should be loaded?
|
||||
// Armour-stands are handled elsewhere and should not be handled by area-wide entity-spawn options
|
||||
if (event.getType() == EntityType.ARMOR_STAND) {
|
||||
return;
|
||||
}
|
||||
// If entities are spawning... the chunk should be loaded?
|
||||
Entity[] entities = event.getSpawnLocation().getChunk().getEntities();
|
||||
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||
if (entities.length >= Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@ -200,7 +204,7 @@ public class PaperListener implements Listener {
|
||||
}
|
||||
}
|
||||
case "BUILD_IRONGOLEM", "BUILD_SNOWMAN", "BUILD_WITHER", "CUSTOM" -> {
|
||||
if (!area.isSpawnCustom() && event.getType() != EntityType.ARMOR_STAND) {
|
||||
if (!area.isSpawnCustom()) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user