Send ELO to players + fix potential crash issue
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
8ebf509b4e
Commit
b5bcea06b7
@ -187,10 +187,6 @@ public class FightTeam implements IFightTeam{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setLeader(FightPlayer leader) {
|
public void setLeader(FightPlayer leader) {
|
||||||
this.leader = leader;
|
|
||||||
if(ready && leader != null)
|
|
||||||
setReady(false);
|
|
||||||
|
|
||||||
if (leader == null){
|
if (leader == null){
|
||||||
if(!players.isEmpty()) {
|
if(!players.isEmpty()) {
|
||||||
setLeader(players.iterator().next());
|
setLeader(players.iterator().next());
|
||||||
@ -202,6 +198,9 @@ public class FightTeam implements IFightTeam{
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.leader = leader;
|
||||||
|
if(ready)
|
||||||
|
setReady(false);
|
||||||
|
|
||||||
leader.setKit(KitManager.getKitByName(Config.LeaderDefault));
|
leader.setKit(KitManager.getKitByName(Config.LeaderDefault));
|
||||||
Inventory inventory = leader.getPlayer().getInventory();
|
Inventory inventory = leader.getPlayer().getInventory();
|
||||||
|
@ -52,8 +52,12 @@ public class FightStatistics {
|
|||||||
int redElo = Elo.getElo(redLeader.getId(), gameMode);
|
int redElo = Elo.getElo(redLeader.getId(), gameMode);
|
||||||
double blueWinExpectation = 1 / (1 + Math.pow(10, (blueElo - redElo) / 400f));
|
double blueWinExpectation = 1 / (1 + Math.pow(10, (blueElo - redElo) / 400f));
|
||||||
double redWinExpectation = 1 / (1 + Math.pow(10, (redElo - blueElo) / 400f));
|
double redWinExpectation = 1 / (1 + Math.pow(10, (redElo - blueElo) / 400f));
|
||||||
Elo.setElo(blueLeader.getId(), gameMode, (int) Math.round(blueElo + K * (blueResult - blueWinExpectation)));
|
int newBlueElo = (int) Math.round(blueElo + K * (blueResult - blueWinExpectation));
|
||||||
Elo.setElo(redLeader.getId(), gameMode, (int) Math.round(redElo + K * (1 - blueResult - redWinExpectation)));
|
int newRedElo = (int) Math.round(redElo + K * (1 - blueResult - redWinExpectation));
|
||||||
|
Elo.setElo(blueLeader.getId(), gameMode, newBlueElo);
|
||||||
|
Elo.setElo(redLeader.getId(), gameMode, newRedElo);
|
||||||
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7ELO von " + Fight.getBlueTeam().getPrefix() + blueLeader.getUserName() + "§8: §7" + blueElo + "§8»§e" + newBlueElo);
|
||||||
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7ELO von " + Fight.getRedTeam().getPrefix() + redLeader.getUserName() + "§8: §7" + redElo + "§8»§e" + newRedElo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren