From 0f9480f69ea29f288fef048cbacf4ec74739e960 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 21 Apr 2020 10:08:02 +0200 Subject: [PATCH] Replace blocks without blockupdates Signed-off-by: Lixfel --- FightSystem_API/src/de/steamwar/fightsystem/Config.java | 2 ++ .../src/de/steamwar/fightsystem/fight/FightTeam.java | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/FightSystem_API/src/de/steamwar/fightsystem/Config.java b/FightSystem_API/src/de/steamwar/fightsystem/Config.java index 3f01869..3150286 100644 --- a/FightSystem_API/src/de/steamwar/fightsystem/Config.java +++ b/FightSystem_API/src/de/steamwar/fightsystem/Config.java @@ -67,6 +67,7 @@ public class Config { public static final boolean TeamBlueRotate; public static final boolean ReplaceObsidian; public static final boolean ReplaceBedrock; + public static final boolean ReplaceWithBlockupdates; //team parameter public static final String TeamRedName; @@ -156,6 +157,7 @@ public class Config { boolean rotate = config.getBoolean("Schematic.Rotate"); ReplaceObsidian = config.getBoolean("Schematic.ReplaceObsidian"); ReplaceBedrock = config.getBoolean("Schematic.ReplaceBedrock"); + ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates"); TeamRedPrefix = config.getString("Output.TeamRedPrefix"); TeamBluePrefix = config.getString("Output.TeamBluePrefix"); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java index e44bbd0..9cb12af 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -384,16 +384,22 @@ public class FightTeam implements IFightTeam{ Location minPoint = new Location(world, cornerX, cornerY, cornerZ); Location maxPoint = new Location(world, (cornerX + Config.SchemsizeX), (cornerY + Config.SchemsizeY), (cornerZ + Config.SchemsizeZ)); + FreezeWorld freezer = null; + if(!Config.ReplaceWithBlockupdates) + freezer = new FreezeWorld(); + for(int x = minPoint.getBlockX(); x <= maxPoint.getBlockX(); x++) { for(int z = minPoint.getBlockZ(); z <= maxPoint.getBlockZ(); z++) { for(int y = minPoint.getBlockY(); y <= maxPoint.getBlockY(); y++) { - Block block = world.getBlockAt(x, y, z); if(block.getType() == target) block.setType(replacement); } } } + + if(!Config.ReplaceWithBlockupdates) + HandlerList.unregisterAll(freezer); } private void setTeamColor(Team team, ChatColor color){