SteamWar/BauSystem
Archiviert
13
0

Fix Sound of TNT ignite with freeze enabled

Dieser Commit ist enthalten in:
jojo 2021-02-03 19:37:52 +01:00
Ursprung c9d33d22b4
Commit 375885bbde

Datei anzeigen

@ -60,24 +60,30 @@ public class CommandFreeze extends RegionToggleCommand {
@EventHandler
public void onEntitySpawn(EntitySpawnEvent e) {
Region.getRegion(e.getLocation(), region -> {
if (region.isFreeze()) e.setCancelled(true);
}, () -> {
if (Region.NoRegion.freeze) e.setCancelled(true);
});
}
@EventHandler(ignoreCancelled = true)
public void onBlockCanBuild(BlockCanBuildEvent e) {
if (!e.isBuildable()) return;
Region.getRegion(e.getBlock().getLocation(), region -> {
if (!region.isFreeze()) {
return;
}
e.setCancelled(true);
if (e.getEntityType() == EntityType.PRIMED_TNT) {
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> {
e.getLocation().getBlock().setType(Material.TNT, false);
}, 1);
if (e.getMaterial() == Material.TNT) {
e.setBuildable(false);
e.getBlock().setType(Material.TNT, false);
}
}, () -> {
if (!Region.NoRegion.freeze) {
return;
}
e.setCancelled(true);
if (e.getEntityType() == EntityType.PRIMED_TNT) {
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> {
e.getLocation().getBlock().setType(Material.TNT, false);
}, 1);
if (e.getMaterial() == Material.TNT) {
e.setBuildable(false);
e.getBlock().setType(Material.TNT, false);
}
});
}