SteamWar/FightSystem
Archiviert
13
1

Fix ranked player does not join arena

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-05-24 08:51:08 +02:00
Ursprung 5ed30e9123
Commit 27d853af19
2 geänderte Dateien mit 16 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -94,6 +94,10 @@ public class FightTeam implements IFightTeam{
team.setAllowFriendlyFire(false); team.setAllowFriendlyFire(false);
} }
public UUID getDesignatedLeader(){
return designatedLeader;
}
public Region getSchemRegion() { public Region getSchemRegion() {
return schemRegion; return schemRegion;
} }

Datei anzeigen

@ -50,12 +50,8 @@ public class FightStatistics {
public static void saveStats(FightTeam winner, String windescription){ public static void saveStats(FightTeam winner, String windescription){
String gameMode = Config.SchematicType.toDB(); String gameMode = Config.SchematicType.toDB();
int blueLeader = 0; int blueLeader = getLeader(Fight.getBlueTeam());
int redLeader = 0; int redLeader = getLeader(Fight.getRedTeam());
if(Fight.getBlueTeam().getLeader() != null)
blueLeader = SteamwarUser.get(Fight.getBlueTeam().getLeader().getPlayer().getUniqueId()).getId();
if(Fight.getRedTeam().getLeader() != null)
redLeader = SteamwarUser.get(Fight.getRedTeam().getLeader().getPlayer().getUniqueId()).getId();
int win = 0; int win = 0;
double blueResult; double blueResult;
@ -109,11 +105,19 @@ public class FightStatistics {
int newRedElo = (int) Math.round(redElo + K * (1 - blueResult - redWinExpectation)); int newRedElo = (int) Math.round(redElo + K * (1 - blueResult - redWinExpectation));
Elo.setElo(blueLeader, gameMode, newBlueElo); Elo.setElo(blueLeader, gameMode, newBlueElo);
Elo.setElo(redLeader, gameMode, newRedElo); Elo.setElo(redLeader, gameMode, newRedElo);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7ELO von " + Fight.getBlueTeam().getPrefix() + Fight.getBlueTeam().getLeader().getPlayer().getName() + "§8: §7" + blueElo + "§8»§e" + newBlueElo); Bukkit.broadcastMessage(FightSystem.PREFIX + "§7ELO von " + Fight.getBlueTeam().getPrefix() + SteamwarUser.get(blueLeader).getUserName() + "§8: §7" + blueElo + "§8»§e" + newBlueElo);
Bukkit.broadcastMessage(FightSystem.PREFIX + "§7ELO von " + Fight.getRedTeam().getPrefix() + Fight.getRedTeam().getLeader().getPlayer().getName() + "§8: §7" + redElo + "§8»§e" + newRedElo); Bukkit.broadcastMessage(FightSystem.PREFIX + "§7ELO von " + Fight.getRedTeam().getPrefix() + SteamwarUser.get(redLeader).getUserName() + "§8: §7" + redElo + "§8»§e" + newRedElo);
} }
} }
private static int getLeader(FightTeam team){
if(team.getLeader() != null)
return SteamwarUser.get(team.getLeader().getPlayer().getUniqueId()).getId();
else if(team.getDesignatedLeader() != null)
return SteamwarUser.get(team.getDesignatedLeader()).getId();
return 0;
}
private static void savePlayerStats(FightPlayer fp, int fightId){ private static void savePlayerStats(FightPlayer fp, int fightId){
SteamwarUser user = SteamwarUser.get(fp.getPlayer().getUniqueId()); SteamwarUser user = SteamwarUser.get(fp.getPlayer().getUniqueId());
de.steamwar.sql.FightPlayer.create(fightId, user.getId(), fp.getTeam().isBlue(), fp.getKit().getName(), fp.getKills(), !fp.isLiving()); de.steamwar.sql.FightPlayer.create(fightId, user.getId(), fp.getTeam().isBlue(), fp.getKit().getName(), fp.getKills(), !fp.isLiving());