Fixes Villager limit

This commit is contained in:
Alberto 2022-01-09 20:50:34 +01:00 committed by GitHub
parent 360ba0b2de
commit fe0e935e14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Animals; import org.bukkit.entity.Animals;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -109,7 +110,7 @@ public class EntityLimitListener implements Listener {
justSpawned.remove(e.getEntity().getUniqueId()); justSpawned.remove(e.getEntity().getUniqueId());
return; return;
} }
if (e.getSpawnReason().equals(SpawnReason.SHOULDER_ENTITY) || e.getSpawnReason().equals(SpawnReason.BREEDING)) { if (e.getSpawnReason().equals(SpawnReason.SHOULDER_ENTITY) || (!(e.getEntity() instanceof Villager ) && e.getSpawnReason().equals(SpawnReason.BREEDING))) {
// Special case - do nothing - jumping around spawns parrots as they drop off player's shoulder // Special case - do nothing - jumping around spawns parrots as they drop off player's shoulder
// Ignore breeding because it's handled in the EntityBreedEvent listener // Ignore breeding because it's handled in the EntityBreedEvent listener
return; return;