Archiviert
13
0

Fix FreezeListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-05-16 17:23:39 +02:00
Ursprung 6d170be583
Commit 7957f1b5e4
2 geänderte Dateien mit 29 neuen und 51 gelöschten Zeilen

Datei anzeigen

@ -30,7 +30,6 @@ import org.bukkit.plugin.java.JavaPlugin;
public final class Builder extends JavaPlugin {
// This should be treated as final!
public static Message MESSAGE;

Datei anzeigen

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