mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 14:16:44 +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();
|
Iterator<Entity> iterator = entities.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entity entity = iterator.next();
|
Entity entity = iterator.next();
|
||||||
|
final String spawnReason = entity.getEntitySpawnReason().name();
|
||||||
|
if ("CUSTOM".equals(spawnReason)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (entity.getType().toString()) {
|
switch (entity.getType().toString()) {
|
||||||
case "EGG":
|
case "EGG":
|
||||||
case "FISHING_HOOK":
|
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) {
|
if (livingEntity.isLeashed() && !Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<MetadataValue> keep = entity.getMetadata("keep");
|
if (entity.hasMetadata("keep")) {
|
||||||
if (!keep.isEmpty()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,10 @@ public class EntitySpawnListener implements Listener {
|
|||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
Location location = BukkitUtil.adapt(entity.getLocation());
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (!location.isPlotArea()) {
|
if (!location.isPlotArea() || area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (area.isSpawnCustom() && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = location.getOwnedPlotAbs();
|
Plot plot = location.getOwnedPlotAbs();
|
||||||
|
Loading…
Reference in New Issue
Block a user