mirror of
https://github.com/kaboomserver/extras.git
synced 2025-02-11 11:40:19 +00:00
Stricter limit for Ender Dragons
This commit is contained in:
parent
524f646563
commit
87ee785860
1 changed files with 52 additions and 18 deletions
|
@ -30,6 +30,8 @@ import org.bukkit.block.Container;
|
||||||
import org.bukkit.block.CreatureSpawner;
|
import org.bukkit.block.CreatureSpawner;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
@ -324,19 +326,35 @@ class Events implements Listener {
|
||||||
Entity[] chunkEntities = event.getLocation().getChunk().getEntities();
|
Entity[] chunkEntities = event.getLocation().getChunk().getEntities();
|
||||||
int onChunk = 0;
|
int onChunk = 0;
|
||||||
|
|
||||||
|
if (entity.getType() == EntityType.ENDER_DRAGON) {
|
||||||
for (Entity chunkEntity : chunkEntities) {
|
for (Entity chunkEntity : chunkEntities) {
|
||||||
if (onChunk < 50) {
|
if (onChunk < 5) {
|
||||||
if (chunkEntity.getType() != EntityType.PLAYER) {
|
if (chunkEntity.getType() == EntityType.ENDER_DRAGON) {
|
||||||
onChunk++;
|
onChunk++;
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onChunk == 50 && entity.getType() != EntityType.PLAYER) {
|
if (onChunk == 5) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
} else if (entity.getType() != EntityType.PLAYER) {
|
||||||
|
for (Entity chunkEntity : chunkEntities) {
|
||||||
|
if (onChunk < 50) {
|
||||||
|
if (chunkEntity.getType() != EntityType.PLAYER) {
|
||||||
|
onChunk++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onChunk == 50) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
LivingEntity mob = (LivingEntity) entity;
|
LivingEntity mob = (LivingEntity) entity;
|
||||||
|
@ -537,19 +555,35 @@ class Events implements Listener {
|
||||||
Entity[] chunkEntities = event.getSpawnLocation().getChunk().getEntities();
|
Entity[] chunkEntities = event.getSpawnLocation().getChunk().getEntities();
|
||||||
int onChunk = 0;
|
int onChunk = 0;
|
||||||
|
|
||||||
|
if (event.getType() == EntityType.ENDER_DRAGON) {
|
||||||
for (Entity chunkEntity : chunkEntities) {
|
for (Entity chunkEntity : chunkEntities) {
|
||||||
if (onChunk < 50) {
|
if (onChunk < 5) {
|
||||||
if (chunkEntity.getType() != EntityType.PLAYER) {
|
if (chunkEntity.getType() == EntityType.ENDER_DRAGON) {
|
||||||
onChunk++;
|
onChunk++;
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onChunk == 50 && event.getType() != EntityType.PLAYER) {
|
if (onChunk == 5) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
} else if (event.getType() != EntityType.PLAYER) {
|
||||||
|
for (Entity chunkEntity : chunkEntities) {
|
||||||
|
if (onChunk < 50) {
|
||||||
|
if (chunkEntity.getType() != EntityType.PLAYER) {
|
||||||
|
onChunk++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onChunk == 50) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
Loading…
Reference in a new issue