SteamWar/FightSystem
Archiviert
13
1

Add Record System

Dieser Commit ist enthalten in:
Chaoscaot 2020-11-16 21:36:28 +01:00
Ursprung 7dbd3ab5cb
Commit 26e71da87a

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.record.RecordSystem;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.winconditions.*; import de.steamwar.fightsystem.winconditions.*;
import de.steamwar.scoreboard.SWScoreboard; import de.steamwar.scoreboard.SWScoreboard;
@ -59,6 +60,8 @@ public class FightScoreboard implements Listener {
SWScoreboard.createScoreboard(event.getPlayer(), new ScoreboardCallback() { SWScoreboard.createScoreboard(event.getPlayer(), new ScoreboardCallback() {
@Override @Override
public HashMap<String, Integer> getData() { public HashMap<String, Integer> getData() {
return objective.getScores(); return objective.getScores();
} }
@ -85,6 +88,8 @@ public class FightScoreboard implements Listener {
private static ScoreBoardObjective generalScoreboard(){ private static ScoreBoardObjective generalScoreboard(){
final ScoreBoardObjective objective = new ScoreBoardObjective("§6Kampf"); final ScoreBoardObjective objective = new ScoreBoardObjective("§6Kampf");
if(Config.recording())
RecordSystem.scoreboardTitle(objective.getTitle());
if (Config.Timeout || Config.Points || Config.HeartRatioTimeout) { if (Config.Timeout || Config.Points || Config.HeartRatioTimeout) {
int fightTime = FightSystem.getFightTime(); int fightTime = FightSystem.getFightTime();
if (fightTime >= 60) if (fightTime >= 60)
@ -113,6 +118,8 @@ public class FightScoreboard implements Listener {
objective.addScore(Fight.getBlueTeam().getPrefix() + "Kanonen: " + WinconditionPumpkinTechKO.getTeamBluePumpkins(), 0); objective.addScore(Fight.getBlueTeam().getPrefix() + "Kanonen: " + WinconditionPumpkinTechKO.getTeamBluePumpkins(), 0);
} }
} }
if(Config.recording())
objective.scores.forEach(RecordSystem::scoreboardData);
return objective; return objective;
} }
@ -141,6 +148,8 @@ public class FightScoreboard implements Listener {
private final HashMap<String, Integer> scores = new HashMap<>(); private final HashMap<String, Integer> scores = new HashMap<>();
public ScoreBoardObjective(String title) { public ScoreBoardObjective(String title) {
if(Config.recording())
RecordSystem.scoreboardTitle(title);
this.title = title; this.title = title;
} }
@ -149,6 +158,8 @@ public class FightScoreboard implements Listener {
} }
public void addScore(String string, int i) { public void addScore(String string, int i) {
if(Config.recording())
RecordSystem.scoreboardData(string, i);
scores.put(string, i); scores.put(string, i);
} }