From cbc1dd6505038fb5e7de1a6194c99e0bce6d97a2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 1 Apr 2022 10:55:29 +0200 Subject: [PATCH] Update some stuff --- .../bungeecore/comms/handlers/FightEndsHandler.java | 8 ++++---- src/de/steamwar/bungeecore/sql/UserElo.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java b/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java index 0dda622..b563a7f 100644 --- a/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java +++ b/src/de/steamwar/bungeecore/comms/handlers/FightEndsHandler.java @@ -23,10 +23,7 @@ import com.google.common.io.ByteArrayDataInput; import de.steamwar.bungeecore.ArenaMode; import de.steamwar.bungeecore.comms.SpigotHandler; import de.steamwar.bungeecore.comms.packets.FightEndsPacket; -import de.steamwar.bungeecore.sql.SchemElo; -import de.steamwar.bungeecore.sql.SchematicNode; -import de.steamwar.bungeecore.sql.SchematicType; -import de.steamwar.bungeecore.sql.UserElo; +import de.steamwar.bungeecore.sql.*; import net.md_5.bungee.api.config.ServerInfo; import java.util.List; @@ -66,6 +63,8 @@ public class FightEndsHandler implements SpigotHandler { blueResult = 0; } + // TODO: Implement hourly unranked when against same team maybe half hourly + int blueSchemElo = SchemElo.getElo(fightEndsPacket.getBlueSchem()); int redSchemElo = SchemElo.getElo(fightEndsPacket.getRedSchem()); @@ -84,6 +83,7 @@ public class FightEndsHandler implements SpigotHandler { double winTeamExpectation = 1 / (1 + Math.pow(10, (eloTeamEnemy - eloTeamOwn) / 600f)); for (int player : players) { int playerElo = UserElo.getEloOrDefault(player, gameMode); + int fights = UserElo.getFightsOfSeason(player, gameMode); UserElo.setElo(player, gameMode, (int) Math.round(playerElo + K * (result - winTeamExpectation))); } } diff --git a/src/de/steamwar/bungeecore/sql/UserElo.java b/src/de/steamwar/bungeecore/sql/UserElo.java index 6740966..efa0078 100644 --- a/src/de/steamwar/bungeecore/sql/UserElo.java +++ b/src/de/steamwar/bungeecore/sql/UserElo.java @@ -56,7 +56,7 @@ public class UserElo { }, userID, gameMode, Season.getSeason())); } - private static int getFightsOfSeason(int userID, String gameMode) { + public static int getFightsOfSeason(int userID, String gameMode) { return fightsOfSeason.select(rs -> { if (rs.next()) return rs.getInt("Fights");