mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 06:06:45 +01:00
Do not remove entitys with CUSTOM spawn-reason on CreatureSpawnEvent. (#4297)
Do not remove entitys with CUSTOM spawn-reason.
This commit is contained in:
parent
a1d94af242
commit
fccc146053
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user