From 625f39fba42b262d751aeb612dd643ff4984ea9f Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 16 Aug 2023 23:10:02 +0200 Subject: [PATCH] Refactors --- src/de/steamwar/towerrun/config/WorldConfig.java | 2 ++ src/de/steamwar/towerrun/game/TowerRunGame.java | 4 ++-- src/world.yml | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/towerrun/config/WorldConfig.java b/src/de/steamwar/towerrun/config/WorldConfig.java index 6cf6c92..e65ceed 100644 --- a/src/de/steamwar/towerrun/config/WorldConfig.java +++ b/src/de/steamwar/towerrun/config/WorldConfig.java @@ -42,6 +42,7 @@ public class WorldConfig { public static final Region[] REGIONS; public static final Location[] DOORS; public static final int LAVA_Y; + public static final int LAVE_SPACE; public static final Location SPAWN; public static final int ESCAPE_HEIGHT; public static final Location MIN_TOWER; @@ -126,6 +127,7 @@ public class WorldConfig { } LAVA_Y = tower.getInt("lavaY"); + LAVE_SPACE = tower.getInt("laveSpace"); ACTIVE_WINCONDITIONS = config.getStringList("winconditions"); WINCONDITIONS.stream().filter(winCondition -> ACTIVE_WINCONDITIONS.contains(winCondition.getName())).forEach(winCondition -> winCondition.setActive(true)); } diff --git a/src/de/steamwar/towerrun/game/TowerRunGame.java b/src/de/steamwar/towerrun/game/TowerRunGame.java index 7539974..365b4a7 100644 --- a/src/de/steamwar/towerrun/game/TowerRunGame.java +++ b/src/de/steamwar/towerrun/game/TowerRunGame.java @@ -56,8 +56,8 @@ public class TowerRunGame { } private static void generateLava() { - for (int x = WorldConfig.MIN_TOWER.getBlockX(); x < WorldConfig.MAX_TOWER.getBlockX(); x += 7) { - for (int z = WorldConfig.MIN_TOWER.getBlockZ(); z < WorldConfig.MAX_TOWER.getBlockZ(); z += 7) { + for (int x = WorldConfig.MIN_TOWER.getBlockX(); x < WorldConfig.MAX_TOWER.getBlockX(); x += WorldConfig.LAVE_SPACE) { + for (int z = WorldConfig.MIN_TOWER.getBlockZ(); z < WorldConfig.MAX_TOWER.getBlockZ(); z += WorldConfig.LAVE_SPACE) { Vector pos = new Vector(x, 0, z); if (Arrays.stream(WorldConfig.REGIONS).anyMatch(region -> region.contains(pos))) { WorldConfig.MIN_TOWER.getWorld().getBlockAt(x, WorldConfig.LAVA_Y, z).setType(Material.LAVA, true); diff --git a/src/world.yml b/src/world.yml index 54be90d..7d13b61 100644 --- a/src/world.yml +++ b/src/world.yml @@ -27,6 +27,7 @@ tower: y: 167 z: 309 lavaY: 220 + laveSpace: 7 winconditions: - LAST_REMAINING