From afab77418f9ddf56ecf1042af1f6b778f46df33c Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 22 Dec 2019 21:58:18 +0100 Subject: [PATCH 1/2] Fixing some issues regarding PointSystem Signed-off-by: Lixfel --- .../de/steamwar/fightsystem/FightSystem.java | 8 ++--- .../fightsystem/utils/FightScoreboard.java | 30 +++++++++++-------- .../WinconditionRelativePercent.java | 1 + 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java index 98f38e9..88c6b6d 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/FightSystem.java @@ -113,6 +113,9 @@ public class FightSystem extends JavaPlugin { new WinconditionAllDead(); new WinconditionCaptainDead(); new WinconditionWaterTechKO(); + new WinconditionPercentSystem(); + new WinconditionRelativePercent(); + new WinconditionPoints(); if(Config.event()){ new EventTeamOffWincondition(); @@ -127,12 +130,9 @@ public class FightSystem extends JavaPlugin { setAllPlayersGM(GameMode.SURVIVAL); - new WinconditionTechKO(); new WinconditionTimeout(); new WinconditionEntern(); - new WinconditionPercentSystem(); - new WinconditionRelativePercent(); - new WinconditionPoints(); + new WinconditionTechKO(); WaterRemover.init(); diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/utils/FightScoreboard.java b/FightSystem_Main/src/de/steamwar/fightsystem/utils/FightScoreboard.java index f5ce957..fc02511 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/utils/FightScoreboard.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/utils/FightScoreboard.java @@ -3,6 +3,7 @@ package de.steamwar.fightsystem.utils; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.fight.Fight; +import de.steamwar.fightsystem.fight.FightState; import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.winconditions.WinconditionPercentSystem; import de.steamwar.fightsystem.winconditions.WinconditionPoints; @@ -62,7 +63,7 @@ public class FightScoreboard { private static void generalScoreboard(){ objective.setDisplayName("§6Kampf"); - if (Config.Timeout) { + if (Config.Timeout || Config.Points) { int fightTime = FightSystem.getFightTime(); if (fightTime >= 60) objective.getScore("§7Zeit: §a" + fightTime / 60 + "m " + fightTime % 60 + "s").setScore(3); @@ -71,18 +72,21 @@ public class FightScoreboard { } if (Config.Entern) objective.getScore("§7Entern: " + (FightSystem.isEntern() ? "§aja" : "§cnein")).setScore(2); - if (Config.PercentSystem){ - objective.getScore(Fight.getRedTeam().getPrefix() + "Schaden: " + (Math.round(100.0 * WinconditionPercentSystem.getRedPercent()) / 100.0) + "%").setScore(1); - objective.getScore(Fight.getBlueTeam().getPrefix() + "Schaden: " + (Math.round(100.0 * WinconditionPercentSystem.getBluePercent()) / 100.0) + "%").setScore(0); - }else if(Config.WaterTechKO){ - objective.getScore(Fight.getRedTeam().getPrefix() + "Wasser: " + WinconditionWaterTechKO.getTeamRedWater()).setScore(1); - objective.getScore(Fight.getBlueTeam().getPrefix() + "Wasser: " + WinconditionWaterTechKO.getTeamBlueWater()).setScore(0); - }else if(Config.RelativePercent){ - objective.getScore(Fight.getRedTeam().getPrefix() + "Schaden: " + WinconditionRelativePercent.getRed().getPrintablePercent() + "%").setScore(1); - objective.getScore(Fight.getBlueTeam().getPrefix() + "Schaden: " + WinconditionRelativePercent.getBlue().getPrintablePercent() + "%").setScore(0); - }else if(Config.Points){ - objective.getScore(Fight.getRedTeam().getPrefix() + "Punkte: " + WinconditionPoints.getRed().getPoints()).setScore(1); - objective.getScore(Fight.getBlueTeam().getPrefix() + "Punkte: " + WinconditionPoints.getBlue().getPoints()).setScore(0); + + if(FightSystem.getFightState() == FightState.RUNNING){ + if (Config.PercentSystem){ + objective.getScore(Fight.getRedTeam().getPrefix() + "Schaden: " + (Math.round(100.0 * WinconditionPercentSystem.getRedPercent()) / 100.0) + "%").setScore(1); + objective.getScore(Fight.getBlueTeam().getPrefix() + "Schaden: " + (Math.round(100.0 * WinconditionPercentSystem.getBluePercent()) / 100.0) + "%").setScore(0); + }else if(Config.WaterTechKO){ + objective.getScore(Fight.getRedTeam().getPrefix() + "Wasser: " + WinconditionWaterTechKO.getTeamRedWater()).setScore(1); + objective.getScore(Fight.getBlueTeam().getPrefix() + "Wasser: " + WinconditionWaterTechKO.getTeamBlueWater()).setScore(0); + }else if(Config.RelativePercent){ + objective.getScore(Fight.getRedTeam().getPrefix() + "Schaden: " + WinconditionRelativePercent.getRed().getPrintablePercent() + "%").setScore(1); + objective.getScore(Fight.getBlueTeam().getPrefix() + "Schaden: " + WinconditionRelativePercent.getBlue().getPrintablePercent() + "%").setScore(0); + }else if(Config.Points){ + objective.getScore(Fight.getRedTeam().getPrefix() + "Punkte: " + WinconditionPoints.getRed().getPoints()).setScore(1); + objective.getScore(Fight.getBlueTeam().getPrefix() + "Punkte: " + WinconditionPoints.getBlue().getPoints()).setScore(0); + } } } diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionRelativePercent.java b/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionRelativePercent.java index 3dfe9a8..2ae481e 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionRelativePercent.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionRelativePercent.java @@ -51,6 +51,7 @@ public class WinconditionRelativePercent{ TeamPercent(FightTeam team){ this.team = team; this.blockCount = currentBlocks(); + this.currentBlocks = blockCount; Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), () -> { currentBlocks = currentBlocks(); From 156df367f24872e72774d14f8940b35cda9c66b0 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 23 Dec 2019 22:46:36 +0100 Subject: [PATCH 2/2] Fixing wincondition Signed-off-by: Lixfel --- .../steamwar/fightsystem/winconditions/WinconditionPoints.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionPoints.java b/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionPoints.java index 893e081..1fab87c 100644 --- a/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionPoints.java +++ b/FightSystem_Main/src/de/steamwar/fightsystem/winconditions/WinconditionPoints.java @@ -46,7 +46,7 @@ public class WinconditionPoints extends PlayerWincondition { if(fightTeam.isPlayerLeader(player)) { enemy.points += 500; Bukkit.broadcastMessage(FightSystem.PREFIX + "§cDer Leader von " + fightTeam.getPrefix() + fightTeam.getColoredName() + message); - FightSystem.setSpectateState(Fight.getOpposite(fightTeam)); + fightEnds(); }else if(fightTeam.getPlayers().size() <= 5) enemy.points += 300; else