Hotfix NPE
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
5a9e281c95
Commit
542547fd5b
@ -97,7 +97,7 @@ public class WinconditionPoints extends PlayerWincondition {
|
||||
public static class TeamPoints {
|
||||
private final FightTeam enemy;
|
||||
private final WinconditionRelativePercent.TeamPercent enemyPercent;
|
||||
private final double factor;
|
||||
private double factor;
|
||||
private static final int maxPoints = 2000;
|
||||
|
||||
private int points;
|
||||
@ -107,18 +107,21 @@ public class WinconditionPoints extends PlayerWincondition {
|
||||
this.enemyPercent = enemyPercent;
|
||||
points = 0;
|
||||
|
||||
if(enemyPercent.getBlockCount() < ownPercent.getBlockCount())
|
||||
this.factor = 10000; //Original mit 20 (20% = 0.2 ergeben 2000 Punkte
|
||||
else{
|
||||
double f = 10000.0 * ownPercent.getBlockCount() / enemyPercent.getBlockCount();
|
||||
//Prevent NPE
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () ->{
|
||||
if(enemyPercent.getBlockCount() < ownPercent.getBlockCount())
|
||||
this.factor = 10000; //Original mit 20 (20% = 0.2 ergeben 2000 Punkte
|
||||
else{
|
||||
double f = 10000.0 * ownPercent.getBlockCount() / enemyPercent.getBlockCount();
|
||||
|
||||
if(f > 10000)
|
||||
f = 10000;
|
||||
else if(f < 4000)
|
||||
f = 4000;
|
||||
if(f > 10000)
|
||||
f = 10000;
|
||||
else if(f < 4000)
|
||||
f = 4000;
|
||||
|
||||
this.factor = f;
|
||||
}
|
||||
this.factor = f;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int getPoints(){
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren