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 @EventHandler
public void onEntitySpawn(EntitySpawnEvent e) { public void onEntitySpawn(EntitySpawnEvent e) {
Region.getRegion(e.getLocation(), region -> { 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()) { if (!region.isFreeze()) {
return; return;
} }
e.setCancelled(true); if (e.getMaterial() == Material.TNT) {
if (e.getEntityType() == EntityType.PRIMED_TNT) { e.setBuildable(false);
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> { e.getBlock().setType(Material.TNT, false);
e.getLocation().getBlock().setType(Material.TNT, false);
}, 1);
} }
}, () -> { }, () -> {
if (!Region.NoRegion.freeze) { if (!Region.NoRegion.freeze) {
return; return;
} }
e.setCancelled(true); if (e.getMaterial() == Material.TNT) {
if (e.getEntityType() == EntityType.PRIMED_TNT) { e.setBuildable(false);
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> { e.getBlock().setType(Material.TNT, false);
e.getLocation().getBlock().setType(Material.TNT, false);
}, 1);
} }
}); });
} }