Items no longer despawn on road when natural_mob_spawning = true and kill-road-items = false (#3764)

* fix: handling of item despawning on road

* chore: de-duplicate check

* chore: check in PaperListener for consistency
This commit is contained in:
Pierre Maurice Schwang 2022-08-10 10:22:19 +02:00 committed by GitHub
parent 3d19c5c2ad
commit cba1927cc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -126,16 +126,16 @@ public class EntitySpawnListener implements Listener {
Plot plot = location.getOwnedPlotAbs();
EntityType type = entity.getType();
if (plot == null) {
if (type == EntityType.DROPPED_ITEM) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true);
}
return;
}
if (!area.isMobSpawning()) {
if (type == EntityType.PLAYER) {
return;
}
if (type == EntityType.DROPPED_ITEM) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true);
}
return;
}
if (type.isAlive()) {
event.setCancelled(true);
}

View File

@ -229,17 +229,17 @@ public class PaperListener implements Listener {
Plot plot = location.getOwnedPlotAbs();
if (plot == null) {
EntityType type = event.getType();
// PreCreatureSpawnEvent **should** not be called for DROPPED_ITEM, just for the sake of consistency
if (type == EntityType.DROPPED_ITEM) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setCancelled(true);
}
return;
}
if (!area.isMobSpawning()) {
if (type == EntityType.PLAYER) {
return;
}
if (type == EntityType.DROPPED_ITEM) {
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
event.setShouldAbortSpawn(true);
event.setCancelled(true);
}
return;
}
if (type.isAlive()) {
event.setShouldAbortSpawn(true);
event.setCancelled(true);