From 5a862b251bae47d8f248d40603e19fbef706256c Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Mon, 13 Apr 2026 20:29:47 +0200 Subject: [PATCH] Add BlockFormListener --- .../src/de/steamwar/sql/GameModeConfig.java | 8 ++++ .../listener/BlockFormListener.java | 44 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java diff --git a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java index 48989139..686470ff 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java +++ b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java @@ -440,6 +440,13 @@ public final class GameModeConfig { */ public final boolean DisableSnowMelt; + /** + * Disable ice forming + * + * @implSpec {@code false} by default + */ + public final boolean DisableIceForm; + /** * Allow leaving the arena area as spectator * @@ -470,6 +477,7 @@ public final class GameModeConfig { BorderFromSchematic = loader.getInt("BorderFromSchematic", 21); GroundWalkable = loader.getBoolean("GroundWalkable", true); DisableSnowMelt = loader.getBoolean("DisableSnowMelt", false); + DisableIceForm = loader.getBoolean("DisableIceForm", false); Leaveable = loader.getBoolean("Leaveable", false); AllowMissiles = loader.getBoolean("AllowMissiles", !EnterStages.isEmpty()); NoFloor = loader.getBoolean("NoFloor", false); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java new file mode 100644 index 00000000..f24124c0 --- /dev/null +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java @@ -0,0 +1,44 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2026 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.fightsystem.listener; + +import de.steamwar.fightsystem.Config; +import de.steamwar.fightsystem.states.FightState; +import de.steamwar.fightsystem.states.StateDependentListener; +import de.steamwar.linkage.Linked; +import org.bukkit.Material; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockFormEvent; + +@Linked +public class BlockFormListener implements Listener { + + public BlockFormListener() { + new StateDependentListener(Config.GameModeConfig.Arena.DisableIceForm, FightState.All, this); + } + + @EventHandler + public void onBlockForm(BlockFormEvent event) { + if (Config.ArenaRegion.inRegion(event.getBlock()) && event.getBlock().getType() == Material.ICE) { + event.setCancelled(true); + } + } +}