diff --git a/src/main/java/com/justinwflory/ritcommandcenter/RitCommandCenter.java b/src/main/java/com/justinwflory/ritcommandcenter/RitCommandCenter.java index c0fc56b..b32a2a4 100644 --- a/src/main/java/com/justinwflory/ritcommandcenter/RitCommandCenter.java +++ b/src/main/java/com/justinwflory/ritcommandcenter/RitCommandCenter.java @@ -33,6 +33,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -198,6 +199,14 @@ private synchronized Set getMutedSet(UUID uuid) { return back; } + @EventHandler + public void onEntitySpawn(EntitySpawnEvent e) { + if (e.getLocation().getChunk().getEntities().length > 300) { + if (e.getEntityType() == EntityType.CHICKEN || e.getEntityType() == EntityType.SKELETON) { + e.setCancelled(true); + } + } + } } // if (tired) justin.goToSleep(); \ No newline at end of file