From c96089606a8b3c3075352bfd433c98e21cc0c01c Mon Sep 17 00:00:00 2001 From: Yaruma3341 Date: Fri, 2 Aug 2019 23:04:37 +0200 Subject: [PATCH] bugfixes Signed-off-by: Yaruma3341 --- .../yaruma/fightsystem/fight/FightTeam.java | 1 - .../fightsystem/fight/WaterRemover.java | 1 - .../winconditions/WinconditionTechKO.java | 40 +------------------ 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/src/me/yaruma/fightsystem/fight/FightTeam.java b/src/me/yaruma/fightsystem/fight/FightTeam.java index 6edda79..fe2ef21 100644 --- a/src/me/yaruma/fightsystem/fight/FightTeam.java +++ b/src/me/yaruma/fightsystem/fight/FightTeam.java @@ -217,7 +217,6 @@ public class FightTeam { if(Fight.getOpposite(this).hasSchematic()){ pasteSchematic(); Fight.getOpposite(this).pasteSchematic(); - Bukkit.getScheduler().scheduleSyncDelayedTask(FightSystem.getPlugin(), WinconditionTechKO::addWater, 20*10L); } } diff --git a/src/me/yaruma/fightsystem/fight/WaterRemover.java b/src/me/yaruma/fightsystem/fight/WaterRemover.java index cabc173..6a77ca5 100644 --- a/src/me/yaruma/fightsystem/fight/WaterRemover.java +++ b/src/me/yaruma/fightsystem/fight/WaterRemover.java @@ -71,7 +71,6 @@ public class WaterRemover { for (Block block : blocksToRemove) { block.setType(Material.AIR); } - WinconditionTechKO.removeWater(); }); } diff --git a/src/me/yaruma/fightsystem/winconditions/WinconditionTechKO.java b/src/me/yaruma/fightsystem/winconditions/WinconditionTechKO.java index bb7c4d1..17b19da 100644 --- a/src/me/yaruma/fightsystem/winconditions/WinconditionTechKO.java +++ b/src/me/yaruma/fightsystem/winconditions/WinconditionTechKO.java @@ -9,7 +9,6 @@ import org.bukkit.Location; import org.bukkit.Material; import java.util.HashSet; -import java.util.Iterator; public class WinconditionTechKO { @@ -17,7 +16,7 @@ public class WinconditionTechKO { private static HashSet teamBlueWater = new HashSet<>(); private static int taskID; - public static void addWater() { + public static void renewWater() { if(!Config.TechKO) return; if(FightSystem.getFightState() != FightState.PRE_RUNNING && FightSystem.getFightState() != FightState.RUNNING) return; @@ -75,44 +74,9 @@ public class WinconditionTechKO { } } - public static void removeWater() { - if(!Config.TechKO) return; - if(FightSystem.getFightState() != FightState.PRE_RUNNING && FightSystem.getFightState() != FightState.RUNNING) return; - - //Team Red - Iterator itrRed = teamRedWater.iterator(); - while (itrRed.hasNext()) { - Location location = (Location) itrRed.next(); - if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER) { - itrRed.remove(); - } - } - if(teamRedWater.isEmpty()) { - Bukkit.getScheduler().cancelTask(getTaskID()); - Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + Config.TeamRedPrefix + Config.TeamRedName + " §6ist Tech K.O.!"); - FightSystem.getPlugin().setSpectateState(Fight.getBlueTeam()); - FightSystem.getPlugin().getWaterRemover().stop(); - } - - //Team Blue - Iterator itrBlue = teamBlueWater.iterator(); - while (itrBlue.hasNext()) { - Location location = (Location) itrBlue.next(); - if(location.getBlock().getType() != Material.WATER && location.getBlock().getType() != Material.STATIONARY_WATER) { - itrBlue.remove(); - } - } - if(teamBlueWater.isEmpty()) { - Bukkit.getScheduler().cancelTask(getTaskID()); - Bukkit.broadcastMessage(FightSystem.PREFIX + "§6Das Team " + Config.TeamBluePrefix + Config.TeamBlueName + " §6ist Tech K.O.!"); - FightSystem.getPlugin().setSpectateState(Fight.getRedTeam()); - FightSystem.getPlugin().getWaterRemover().stop(); - } - } - public static void startAutoChecker() { if(!Config.TechKO) return; - taskID = Bukkit.getScheduler().scheduleAsyncRepeatingTask(FightSystem.getPlugin(), WinconditionTechKO::addWater, 400, 400); + taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(FightSystem.getPlugin(), WinconditionTechKO::renewWater, 400, 400); } public static int getTaskID() {