diff --git a/src/de/steamwar/misslewars/MissileWars.java b/src/de/steamwar/misslewars/MissileWars.java index 44e74a7..ee2492b 100644 --- a/src/de/steamwar/misslewars/MissileWars.java +++ b/src/de/steamwar/misslewars/MissileWars.java @@ -32,7 +32,9 @@ import de.steamwar.misslewars.listener.*; import de.steamwar.misslewars.listener.special.BarrierListener; import de.steamwar.misslewars.listener.special.SpaceListener; import de.steamwar.misslewars.slowmo.SlowMoRunner; +import de.steamwar.network.NetworkSender; import de.steamwar.network.packets.common.FightEndsPacket; +import de.steamwar.sql.SteamwarUser; import org.bukkit.*; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -147,9 +149,20 @@ public class MissileWars extends JavaPlugin { player.setGameMode(GameMode.SPECTATOR); } - // TODO: FightsEndPacket for ELO... + byte ergebnis = winner == blueTeam ? (byte) 1 : (byte) 2; if (Config.isEvent()) { - Config.EventKampf.setErgebnis(winner == blueTeam ? 1 : 2); + Config.EventKampf.setErgebnis(ergebnis); + } else { + FightEndsPacket packet = FightEndsPacket.builder() + .gameMode("MissileWars") + .duration((int)((System.currentTimeMillis() - FightScoreboard.getStartTime()) / 1000)) + .win(ergebnis) + .bluePlayers(blueTeam.getPlayers().stream().map(Player::getUniqueId).map(SteamwarUser::get).map(SteamwarUser::getId).collect(Collectors.toList())) + .redPlayers(redTeam.getPlayers().stream().map(Player::getUniqueId).map(SteamwarUser::get).map(SteamwarUser::getId).collect(Collectors.toList())) + .blueSchem(-1) + .redSchem(-1) + .build(); + NetworkSender.send(packet); } switch (reason) {