mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
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:
parent
3d19c5c2ad
commit
cba1927cc7
@ -126,16 +126,16 @@ public class EntitySpawnListener implements Listener {
|
|||||||
Plot plot = location.getOwnedPlotAbs();
|
Plot plot = location.getOwnedPlotAbs();
|
||||||
EntityType type = entity.getType();
|
EntityType type = entity.getType();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
|
if (type == EntityType.DROPPED_ITEM) {
|
||||||
|
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!area.isMobSpawning()) {
|
if (!area.isMobSpawning()) {
|
||||||
if (type == EntityType.PLAYER) {
|
if (type == EntityType.PLAYER) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type == EntityType.DROPPED_ITEM) {
|
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (type.isAlive()) {
|
if (type.isAlive()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -229,17 +229,17 @@ public class PaperListener implements Listener {
|
|||||||
Plot plot = location.getOwnedPlotAbs();
|
Plot plot = location.getOwnedPlotAbs();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
EntityType type = event.getType();
|
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 (!area.isMobSpawning()) {
|
||||||
if (type == EntityType.PLAYER) {
|
if (type == EntityType.PLAYER) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type == EntityType.DROPPED_ITEM) {
|
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
|
||||||
event.setShouldAbortSpawn(true);
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (type.isAlive()) {
|
if (type.isAlive()) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user