SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'Fix Sound of TNT ignite with freeze enabled' (#178) from FixFreeze into master

Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
YoyoNow 2021-02-03 19:41:23 +01:00
Commit 664e3a4cf9

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