Fix relative wincondition
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
68f4da0f4f
Commit
2937d65683
@ -50,17 +50,7 @@ public class WinconditionRelativePercent extends Wincondition implements Printab
|
|||||||
super("RelativePercent", null);
|
super("RelativePercent", null);
|
||||||
teamMap.put(Fight.getBlueTeam(), new TeamPercent(Fight.getBlueTeam()));
|
teamMap.put(Fight.getBlueTeam(), new TeamPercent(Fight.getBlueTeam()));
|
||||||
teamMap.put(Fight.getRedTeam(), new TeamPercent(Fight.getRedTeam()));
|
teamMap.put(Fight.getRedTeam(), new TeamPercent(Fight.getRedTeam()));
|
||||||
new StateDependent(Winconditions.RELATIVE_PERCENT, FightState.Running){
|
|
||||||
@Override
|
|
||||||
public void enable() {
|
|
||||||
teamMap.values().forEach(TeamPercent::enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disable() {
|
|
||||||
teamMap.values().forEach(TeamPercent::disable);
|
|
||||||
}
|
|
||||||
}.register();
|
|
||||||
if(Config.ActiveWinconditions.contains(Winconditions.RELATIVE_PERCENT)){
|
if(Config.ActiveWinconditions.contains(Winconditions.RELATIVE_PERCENT)){
|
||||||
printableWinconditions.add(this);
|
printableWinconditions.add(this);
|
||||||
percentWincondition = this;
|
percentWincondition = this;
|
||||||
@ -77,7 +67,7 @@ public class WinconditionRelativePercent extends Wincondition implements Printab
|
|||||||
return team.getPrefix() + "Schaden: " + (Math.round(100.0 * getPercent(team)) / 100.0) + "%";
|
return team.getPrefix() + "Schaden: " + (Math.round(100.0 * getPercent(team)) / 100.0) + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TeamPercent {
|
public static class TeamPercent extends StateDependent {
|
||||||
private final FightTeam team;
|
private final FightTeam team;
|
||||||
|
|
||||||
private int blockCount;
|
private int blockCount;
|
||||||
@ -85,15 +75,19 @@ public class WinconditionRelativePercent extends Wincondition implements Printab
|
|||||||
private int currentBlocks;
|
private int currentBlocks;
|
||||||
|
|
||||||
public TeamPercent(FightTeam team){
|
public TeamPercent(FightTeam team){
|
||||||
|
super(Winconditions.RELATIVE_PERCENT, FightState.Running);
|
||||||
this.team = team;
|
this.team = team;
|
||||||
this.currentBlocks = 1;
|
this.currentBlocks = 1;
|
||||||
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void enable(){
|
public void enable(){
|
||||||
blockCount = currentBlocks();
|
blockCount = currentBlocks();
|
||||||
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::check, 400, 400);
|
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::check, 400, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void disable(){
|
public void disable(){
|
||||||
task.cancel();
|
task.cancel();
|
||||||
}
|
}
|
||||||
@ -122,7 +116,7 @@ public class WinconditionRelativePercent extends Wincondition implements Printab
|
|||||||
|
|
||||||
private int currentBlocks(){
|
private int currentBlocks(){
|
||||||
// Entern active
|
// Entern active
|
||||||
if(!Config.EnterStages.isEmpty() && Config.EnterStages.get(0) >= Config.TimeoutTime - Wincondition.getTimeOverCountdown().getTimeLeft())
|
if(!Config.EnterStages.isEmpty() && Config.EnterStages.get(0) >= Wincondition.getTimeOverCountdown().getTimeLeft())
|
||||||
return currentBlocks;
|
return currentBlocks;
|
||||||
|
|
||||||
currentBlocks = 0;
|
currentBlocks = 0;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren