mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-27 09:55:36 -05:00
More TNT optimizations
This commit is contained in:
parent
86b3e68a4a
commit
95a0b66af2
2 changed files with 8 additions and 14 deletions
|
@ -73,12 +73,12 @@ class BlockPhysics implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
/*@EventHandler
|
||||
void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
if (event.getSourceBlock().getState() instanceof CommandBlock) {
|
||||
event.getSourceBlock().getState().update();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@EventHandler
|
||||
void onBlockRedstone(BlockRedstoneEvent event) {
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
|
|||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
import com.destroystokyo.paper.event.block.TNTPrimeEvent;
|
||||
import com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason;
|
||||
|
||||
import com.destroystokyo.paper.event.entity.EntityAddToWorldEvent;
|
||||
import com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent;
|
||||
|
@ -101,7 +102,7 @@ class EntitySpawn implements Listener {
|
|||
|
||||
final int worldDragonCount = location.getWorld().getEntitiesByClass(EnderDragon.class).size();
|
||||
final int worldDragonCountLimit = 24;
|
||||
|
||||
|
||||
if ((entityType != EntityType.PLAYER &&
|
||||
isEntityLimitReached(location, chunkEntityCount, chunkEntityCountLimit, isAddToWorldEvent)) ||
|
||||
|
||||
|
@ -159,11 +160,6 @@ class EntitySpawn implements Listener {
|
|||
}
|
||||
}
|
||||
return true;
|
||||
} else if (tntCount > 180) {
|
||||
for (Entity tnt : world.getEntitiesByClass(TNTPrimed.class)) {
|
||||
tnt.remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -378,12 +374,10 @@ class EntitySpawn implements Listener {
|
|||
|
||||
@EventHandler
|
||||
void onTNTPrime(TNTPrimeEvent event) {
|
||||
final double tps = Bukkit.getTPS()[0];
|
||||
final int tntCount = event.getBlock().getWorld().getEntitiesByClass(TNTPrimed.class).size();
|
||||
|
||||
if (tps < 10 ||
|
||||
tntCount > 140) {
|
||||
event.setCancelled(true);
|
||||
if (event.getBlock().getWorld().getEntitiesByClass(TNTPrimed.class).size() > 120) {
|
||||
if (event.getReason() == PrimeReason.EXPLOSION) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue