Do not remove entitys with CUSTOM spawn-reason on CreatureSpawnEvent. (#4297)

Do not remove entitys with CUSTOM spawn-reason.
This commit is contained in:
Nico Lube 2024-01-21 12:33:53 +01:00 committed by GitHub
parent a1d94af242
commit fccc146053
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -779,6 +779,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
Iterator<Entity> iterator = entities.iterator();
while (iterator.hasNext()) {
Entity entity = iterator.next();
final String spawnReason = entity.getEntitySpawnReason().name();
if ("CUSTOM".equals(spawnReason)) {
continue;
}
switch (entity.getType().toString()) {
case "EGG":
case "FISHING_HOOK":
@ -867,8 +871,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
if (livingEntity.isLeashed() && !Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS) {
continue;
}
List<MetadataValue> keep = entity.getMetadata("keep");
if (!keep.isEmpty()) {
if (entity.hasMetadata("keep")) {
continue;
}

View File

@ -120,7 +120,10 @@ public class EntitySpawnListener implements Listener {
Entity entity = event.getEntity();
Location location = BukkitUtil.adapt(entity.getLocation());
PlotArea area = location.getPlotArea();
if (!location.isPlotArea()) {
if (!location.isPlotArea() || area == null) {
return;
}
if (area.isSpawnCustom() && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
return;
}
Plot plot = location.getOwnedPlotAbs();