forked from kaboomserver/extras
Prevent redstone wire from crashing server
This commit is contained in:
parent
87ef009ba6
commit
5c6d4c5ab9
2 changed files with 30 additions and 23 deletions
|
@ -10,6 +10,7 @@ import org.bukkit.event.EventHandler;
|
|||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
|
||||
|
@ -66,6 +67,18 @@ public class BlockPhysics implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
if (event.getChangedType() == Material.REDSTONE_WIRE) {
|
||||
for (BlockFace face : blockFaces) {
|
||||
if (event.getBlock().getRelative(face).getType() != event.getChangedType()) {
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
void onBlockRedstone(BlockRedstoneEvent event) {
|
||||
final double tps = Bukkit.getServer().getTPS()[0];
|
||||
|
|
|
@ -4,14 +4,9 @@ import org.bukkit.Chunk;
|
|||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -21,16 +16,15 @@ import org.bukkit.entity.LivingEntity;
|
|||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.AreaEffectCloudApplyEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.entity.SpawnerSpawnEvent;
|
||||
|
||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||
|
||||
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;
|
||||
import com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent;
|
||||
|
|
Loading…
Reference in a new issue