SteamWar/BauSystem
Archiviert
13
0

Fix Sound of TNT ignite with freeze enabled #178

Manuell gemergt
YoyoNow hat 2 Commits von FixFreeze nach master 2021-02-03 19:41:24 +01:00 zusammengeführt

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
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);
}
});
}