SteamWar/FightSystem
Archiviert
13
1
Signed-off-by: Yaruma3341 <yaruma3341@gmail.com>
Dieser Commit ist enthalten in:
Yaruma3341 2019-08-02 23:04:37 +02:00
Ursprung ee83bf6177
Commit c96089606a
3 geänderte Dateien mit 2 neuen und 40 gelöschten Zeilen

Datei anzeigen

@ -217,7 +217,6 @@ public class FightTeam {
if(Fight.getOpposite(this).hasSchematic()){ if(Fight.getOpposite(this).hasSchematic()){
pasteSchematic(); pasteSchematic();
Fight.getOpposite(this).pasteSchematic(); Fight.getOpposite(this).pasteSchematic();
Bukkit.getScheduler().scheduleSyncDelayedTask(FightSystem.getPlugin(), WinconditionTechKO::addWater, 20*10L);
} }
} }

Datei anzeigen

@ -71,7 +71,6 @@ public class WaterRemover {
for (Block block : blocksToRemove) { for (Block block : blocksToRemove) {
block.setType(Material.AIR); block.setType(Material.AIR);
} }
WinconditionTechKO.removeWater();
}); });
} }

Datei anzeigen

@ -9,7 +9,6 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
public class WinconditionTechKO { public class WinconditionTechKO {
@ -17,7 +16,7 @@ public class WinconditionTechKO {
private static HashSet<Location> teamBlueWater = new HashSet<>(); private static HashSet<Location> teamBlueWater = new HashSet<>();
private static int taskID; private static int taskID;
public static void addWater() { public static void renewWater() {
if(!Config.TechKO) return; if(!Config.TechKO) return;
if(FightSystem.getFightState() != FightState.PRE_RUNNING && FightSystem.getFightState() != FightState.RUNNING) 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() { public static void startAutoChecker() {
if(!Config.TechKO) return; 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() { public static int getTaskID() {