Archiviert
13
0

Fix FreezeListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-05-16 17:30:44 +02:00
Ursprung 5007add704
Commit 596dce1ffb

Datei anzeigen

@ -46,14 +46,13 @@ public class FreezeListener implements Listener {
Bukkit.getScheduler().runTaskTimer(Builder.getInstance(), () -> {
if (!freeze) return;
Bukkit.getOnlinePlayers().forEach(player -> {
Builder.MESSAGE.sendPrefixless("REGION_FREEZE_ENABLED", player, ChatMessageType.ACTION_BAR);
Builder.MESSAGE.send("REGION_FREEZE_ENABLED", player, ChatMessageType.ACTION_BAR);
});
}, 1, 1);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onEntitySpawn(EntitySpawnEvent e) {
e.setCancelled(false);
if (!freeze) return;
e.setCancelled(true);
if (e.getEntityType() == EntityType.PRIMED_TNT) {
@ -73,29 +72,39 @@ public class FreezeListener implements Listener {
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onPhysicsEvent(BlockPhysicsEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onPistonExtend(BlockPistonExtendEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onPistonRetract(BlockPistonRetractEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onBlockGrow(BlockGrowEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler
@ -105,9 +114,11 @@ public class FreezeListener implements Listener {
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onBlockDispense(BlockDispenseEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler
@ -127,8 +138,6 @@ public class FreezeListener implements Listener {
if (e.isCancelled()) return;
e.setCancelled(true);
e.getBlock().setType(Material.AIR, false);
} else {
e.setCancelled(false);
}
}
@ -146,29 +155,39 @@ public class FreezeListener implements Listener {
}
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onFluidLevelChange(FluidLevelChangeEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onBlockSpread(BlockSpreadEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onBlockFromTo(BlockFromToEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onSpongeAbsorb(SpongeAbsorbEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onBlockForm(BlockFormEvent e) {
e.setCancelled(freeze);
if (freeze) {
e.setCancelled(true);
}
}
@EventHandler
@ -184,8 +203,10 @@ public class FreezeListener implements Listener {
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@EventHandler
public void onBlockFade(BlockFadeEvent event) {
event.setCancelled(freeze);
if (freeze) {
event.setCancelled(true);
}
}
}