From 706f6ed743df5271f2aa6e77c5d62aa10ef69cb9 Mon Sep 17 00:00:00 2001 From: Jakob Schulz <55949993+Lordikak@users.noreply.github.com> Date: Mon, 18 May 2026 21:26:38 +0200 Subject: [PATCH 1/3] add setting to disable block generators --- .../src/de/steamwar/sql/GameModeConfig.java | 8 +++++++ FightSystem/FightSystem_Core/src/config.yml | 4 ++++ .../listener/BlockFormListener.java | 24 +++++++++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java index e2106380..fdebfb6b 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java +++ b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java @@ -467,6 +467,13 @@ public final class GameModeConfig { */ public final boolean DisableIceForm; + /** + * Disable block generators such as cobblestone, stone, obsidian and basalt + * + * @implSpec {@code false} by default + */ + public final boolean DisableBlockGenerators; + /** * Allow leaving the arena area as spectator * @@ -498,6 +505,7 @@ public final class GameModeConfig { GroundWalkable = loader.getBoolean("GroundWalkable", true); DisableSnowMelt = loader.getBoolean("DisableSnowMelt", false); DisableIceForm = loader.getBoolean("DisableIceForm", false); + DisableBlockGenerators = loader.getBoolean("DisableBlockGenerators", false); Leaveable = loader.getBoolean("Leaveable", false); AllowMissiles = loader.getBoolean("AllowMissiles", !EnterStages.isEmpty()); NoFloor = loader.getBoolean("NoFloor", false); diff --git a/FightSystem/FightSystem_Core/src/config.yml b/FightSystem/FightSystem_Core/src/config.yml index 46267a72..0d700de5 100644 --- a/FightSystem/FightSystem_Core/src/config.yml +++ b/FightSystem/FightSystem_Core/src/config.yml @@ -48,6 +48,10 @@ Arena: GroundWalkable: true # defaults to true if missing # Disable snow and ice melting DisableSnowMelt: false # defaults to false if missing + # Disable ice forming + DisableIceForm: false # defaults to false if missing + # Disable cobblestone, stone, obsidian and basalt generators + DisableBlockGenerators: false # defaults to false if missing # Allow leaving the arena area as spectator Leaveable: false # defaults to false if missing # Allow missiles to fly to the enemy and not stop at the schem border. diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java index 29c6be82..275fc4c4 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java @@ -27,17 +27,37 @@ import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockFormEvent; +import java.util.EnumSet; +import java.util.Set; @Linked public class BlockFormListener implements Listener { + private static final Set GENERATOR_BLOCKS = EnumSet.of( + Material.COBBLESTONE, + Material.STONE, + Material.OBSIDIAN, + Material.BASALT + ); + public BlockFormListener() { - new StateDependentListener(Config.GameModeConfig.Arena.DisableIceForm, FightState.All, this); + boolean enabled = Config.GameModeConfig.Arena.DisableIceForm + || Config.GameModeConfig.Arena.DisableBlockGenerators; + new StateDependentListener(enabled, + Config.GameModeConfig.Arena.DisableIceForm ? FightState.All : FightState.Running, + this); } @EventHandler public void onBlockForm(BlockFormEvent event) { - if (Config.ArenaRegion.inRegion(event.getBlock()) && event.getNewState().getType() == Material.ICE) { + if (!Config.ArenaRegion.inRegion(event.getBlock())) return; + + Material material = event.getNewState().getType(); + if (Config.GameModeConfig.Arena.DisableIceForm && material == Material.ICE) { + event.setCancelled(true); + } else if (Config.GameModeConfig.Arena.DisableBlockGenerators + && FightState.infight() + && GENERATOR_BLOCKS.contains(material)) { event.setCancelled(true); } } From e9c766dbbb92b2ff5f76305940543527463a09ef Mon Sep 17 00:00:00 2001 From: Jakob Schulz <55949993+Lordikak@users.noreply.github.com> Date: Tue, 19 May 2026 18:37:57 +0200 Subject: [PATCH 2/3] migrate to per material config --- .../src/de/steamwar/sql/GameModeConfig.java | 24 ++++++++----------- FightSystem/FightSystem_Core/src/config.yml | 11 +++++---- .../listener/BlockFormListener.java | 22 +++-------------- 3 files changed, 20 insertions(+), 37 deletions(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java index fdebfb6b..8a8a9a1f 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java +++ b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java @@ -411,7 +411,7 @@ public final class GameModeConfig { } @ToString - public static final class ArenaConfig { + public static final class ArenaConfig { public final boolean loaded; @@ -461,18 +461,11 @@ public final class GameModeConfig { public final boolean DisableSnowMelt; /** - * Disable ice forming + * Disable the forming of certain blocks * - * @implSpec {@code false} by default + * @implSpec {@code empty} by default */ - public final boolean DisableIceForm; - - /** - * Disable block generators such as cobblestone, stone, obsidian and basalt - * - * @implSpec {@code false} by default - */ - public final boolean DisableBlockGenerators; + public final Set BlockedFormedBlocks; /** * Allow leaving the arena area as spectator @@ -495,7 +488,7 @@ public final class GameModeConfig { */ public final boolean NoFloor; - private ArenaConfig(YMLWrapper loader, SchematicConfig.SizeConfig Size, List EnterStages) { + private ArenaConfig(YMLWrapper loader, SchematicConfig.SizeConfig Size, List EnterStages) { loaded = loader.canLoad(); WaterDepth = loader.getInt("WaterDepth", 0); WaterDamage = loader.getBoolean("WaterDamage", true); @@ -504,8 +497,11 @@ public final class GameModeConfig { BorderFromSchematic = loader.getInt("BorderFromSchematic", 21); GroundWalkable = loader.getBoolean("GroundWalkable", true); DisableSnowMelt = loader.getBoolean("DisableSnowMelt", false); - DisableIceForm = loader.getBoolean("DisableIceForm", false); - DisableBlockGenerators = loader.getBoolean("DisableBlockGenerators", false); + Set blockedFormedBlocks = new HashSet<>(loader.getMaterialList("BlockedFormedBlocks")); + if (loader.getBoolean("DisableIceForm", false)) { + blockedFormedBlocks.add(loader.materialMapper.apply("ICE")); + } + BlockedFormedBlocks = Collections.unmodifiableSet(blockedFormedBlocks); Leaveable = loader.getBoolean("Leaveable", false); AllowMissiles = loader.getBoolean("AllowMissiles", !EnterStages.isEmpty()); NoFloor = loader.getBoolean("NoFloor", false); diff --git a/FightSystem/FightSystem_Core/src/config.yml b/FightSystem/FightSystem_Core/src/config.yml index 0d700de5..81a8ff77 100644 --- a/FightSystem/FightSystem_Core/src/config.yml +++ b/FightSystem/FightSystem_Core/src/config.yml @@ -48,10 +48,13 @@ Arena: GroundWalkable: true # defaults to true if missing # Disable snow and ice melting DisableSnowMelt: false # defaults to false if missing - # Disable ice forming - DisableIceForm: false # defaults to false if missing - # Disable cobblestone, stone, obsidian and basalt generators - DisableBlockGenerators: false # defaults to false if missing + # Disabled blocks from forming + BlockedFormedBlocks: + # For Cobble Generators + # - COBBLESTONE + # - BASALT + # - STONE + # - OBSIDIAN # Allow leaving the arena area as spectator Leaveable: false # defaults to false if missing # Allow missiles to fly to the enemy and not stop at the schem border. diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java index 275fc4c4..c50133c7 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java @@ -27,25 +27,13 @@ import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockFormEvent; -import java.util.EnumSet; -import java.util.Set; @Linked public class BlockFormListener implements Listener { - private static final Set GENERATOR_BLOCKS = EnumSet.of( - Material.COBBLESTONE, - Material.STONE, - Material.OBSIDIAN, - Material.BASALT - ); - public BlockFormListener() { - boolean enabled = Config.GameModeConfig.Arena.DisableIceForm - || Config.GameModeConfig.Arena.DisableBlockGenerators; - new StateDependentListener(enabled, - Config.GameModeConfig.Arena.DisableIceForm ? FightState.All : FightState.Running, - this); + boolean enabled = !Config.GameModeConfig.Arena.BlockedFormedBlocks.isEmpty(); + new StateDependentListener(enabled, FightState.All, this); } @EventHandler @@ -53,11 +41,7 @@ public class BlockFormListener implements Listener { if (!Config.ArenaRegion.inRegion(event.getBlock())) return; Material material = event.getNewState().getType(); - if (Config.GameModeConfig.Arena.DisableIceForm && material == Material.ICE) { - event.setCancelled(true); - } else if (Config.GameModeConfig.Arena.DisableBlockGenerators - && FightState.infight() - && GENERATOR_BLOCKS.contains(material)) { + if (Config.GameModeConfig.Arena.BlockedFormedBlocks.contains(material)) { event.setCancelled(true); } } From deb56c0c028cd403f544644780f3b0944a4a5036 Mon Sep 17 00:00:00 2001 From: Jakob Schulz <55949993+Lordikak@users.noreply.github.com> Date: Tue, 19 May 2026 19:24:03 +0200 Subject: [PATCH 3/3] rename property --- CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java | 10 +++++----- FightSystem/FightSystem_Core/src/config.yml | 5 ++++- .../fightsystem/listener/BlockFormListener.java | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java index 8a8a9a1f..f8b27f59 100644 --- a/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java +++ b/CommonCore/SQL/src/de/steamwar/sql/GameModeConfig.java @@ -465,7 +465,7 @@ public final class GameModeConfig { * * @implSpec {@code empty} by default */ - public final Set BlockedFormedBlocks; + public final Set DisabledBlockForms; /** * Allow leaving the arena area as spectator @@ -488,7 +488,7 @@ public final class GameModeConfig { */ public final boolean NoFloor; - private ArenaConfig(YMLWrapper loader, SchematicConfig.SizeConfig Size, List EnterStages) { + private ArenaConfig(YMLWrapper loader, SchematicConfig.SizeConfig Size, List EnterStages) { loaded = loader.canLoad(); WaterDepth = loader.getInt("WaterDepth", 0); WaterDamage = loader.getBoolean("WaterDamage", true); @@ -497,11 +497,11 @@ public final class GameModeConfig { BorderFromSchematic = loader.getInt("BorderFromSchematic", 21); GroundWalkable = loader.getBoolean("GroundWalkable", true); DisableSnowMelt = loader.getBoolean("DisableSnowMelt", false); - Set blockedFormedBlocks = new HashSet<>(loader.getMaterialList("BlockedFormedBlocks")); + Set disabledBlockForms = new HashSet<>(loader.getMaterialList("DisabledBlockForms")); if (loader.getBoolean("DisableIceForm", false)) { - blockedFormedBlocks.add(loader.materialMapper.apply("ICE")); + disabledBlockForms.add(loader.materialMapper.apply("ICE")); } - BlockedFormedBlocks = Collections.unmodifiableSet(blockedFormedBlocks); + DisabledBlockForms = Collections.unmodifiableSet(disabledBlockForms); Leaveable = loader.getBoolean("Leaveable", false); AllowMissiles = loader.getBoolean("AllowMissiles", !EnterStages.isEmpty()); NoFloor = loader.getBoolean("NoFloor", false); diff --git a/FightSystem/FightSystem_Core/src/config.yml b/FightSystem/FightSystem_Core/src/config.yml index 81a8ff77..81620820 100644 --- a/FightSystem/FightSystem_Core/src/config.yml +++ b/FightSystem/FightSystem_Core/src/config.yml @@ -49,12 +49,15 @@ Arena: # Disable snow and ice melting DisableSnowMelt: false # defaults to false if missing # Disabled blocks from forming - BlockedFormedBlocks: + DisabledBlockForms: # For Cobble Generators # - COBBLESTONE # - BASALT # - STONE # - OBSIDIAN + # Disable ice specifically from forming + # Deprecated, add ICE to DisabledBlockForms list instead + DisableIceForm: false # Allow leaving the arena area as spectator Leaveable: false # defaults to false if missing # Allow missiles to fly to the enemy and not stop at the schem border. diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java index c50133c7..55d58adb 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/BlockFormListener.java @@ -32,7 +32,7 @@ import org.bukkit.event.block.BlockFormEvent; public class BlockFormListener implements Listener { public BlockFormListener() { - boolean enabled = !Config.GameModeConfig.Arena.BlockedFormedBlocks.isEmpty(); + boolean enabled = !Config.GameModeConfig.Arena.DisabledBlockForms.isEmpty(); new StateDependentListener(enabled, FightState.All, this); } @@ -41,7 +41,7 @@ public class BlockFormListener implements Listener { if (!Config.ArenaRegion.inRegion(event.getBlock())) return; Material material = event.getNewState().getType(); - if (Config.GameModeConfig.Arena.BlockedFormedBlocks.contains(material)) { + if (Config.GameModeConfig.Arena.DisabledBlockForms.contains(material)) { event.setCancelled(true); } }