mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-30 11:17:14 -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) {
|
void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
if (event.getSourceBlock().getState() instanceof CommandBlock) {
|
if (event.getSourceBlock().getState() instanceof CommandBlock) {
|
||||||
event.getSourceBlock().getState().update();
|
event.getSourceBlock().getState().update();
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onBlockRedstone(BlockRedstoneEvent event) {
|
void onBlockRedstone(BlockRedstoneEvent event) {
|
||||||
|
|
|
@ -47,6 +47,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
|
||||||
import com.destroystokyo.paper.event.block.TNTPrimeEvent;
|
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.EntityAddToWorldEvent;
|
||||||
import com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent;
|
import com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent;
|
||||||
|
@ -159,11 +160,6 @@ class EntitySpawn implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (tntCount > 180) {
|
|
||||||
for (Entity tnt : world.getEntitiesByClass(TNTPrimed.class)) {
|
|
||||||
tnt.remove();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -378,12 +374,10 @@ class EntitySpawn implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onTNTPrime(TNTPrimeEvent event) {
|
void onTNTPrime(TNTPrimeEvent event) {
|
||||||
final double tps = Bukkit.getTPS()[0];
|
if (event.getBlock().getWorld().getEntitiesByClass(TNTPrimed.class).size() > 120) {
|
||||||
final int tntCount = event.getBlock().getWorld().getEntitiesByClass(TNTPrimed.class).size();
|
if (event.getReason() == PrimeReason.EXPLOSION) {
|
||||||
|
|
||||||
if (tps < 10 ||
|
|
||||||
tntCount > 140) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue