SteamWar/BauSystem2.0
Archiviert
12
0

Fix FreezeListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2022-07-29 22:43:34 +02:00
Ursprung 7330b4346b
Commit b40fe28c7e

Datei anzeigen

@ -101,11 +101,22 @@ public class FreezeListener implements Listener {
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
public void onBlockBreak(BlockBreakEvent e) {
if (Core.getVersion() < 19) return;
if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
event.setCancelled(true);
event.getBlock().setType(Material.AIR, false);
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
e.setCancelled(true);
e.getBlock().setType(Material.AIR, false);
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
if (Core.getVersion() < 19) return;
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
e.setCancelled(true);
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
e.getBlock().setType(e.getItemInHand().getType(), false);
}, 1L);
}
}
@ -124,16 +135,23 @@ public class FreezeListener implements Listener {
}
@EventHandler
public void onBlockFromTo(BlockFromToEvent event) {
if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
event.setCancelled(true);
public void onBlockFromTo(BlockFromToEvent e) {
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
e.setCancelled(true);
}
}
@EventHandler
public void onSpongeAbsorb(SpongeAbsorbEvent event) {
if (Region.getRegion(event.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
event.setCancelled(true);
public void onSpongeAbsorb(SpongeAbsorbEvent e) {
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
e.setCancelled(true);
}
}
@EventHandler
public void onBlockForm(BlockFormEvent e) {
if (Region.getRegion(e.getBlock().getLocation()).get(Flag.FREEZE) == FreezeMode.ACTIVE) {
e.setCancelled(true);
}
}
}