Archiviert
1
0
Dieser Commit ist enthalten in:
yoyosource 2022-04-01 12:28:05 +02:00
Ursprung af61b59c8b
Commit afa9b4e533
2 geänderte Dateien mit 33 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -11,7 +11,7 @@ import java.util.stream.Collectors;
public class Fight {
private static final Statement getPage = new Statement("SELECT f.FightID, f.GameMode, f.Server, f.StartTime, f.BlueLeader, f.RedLeader, (b.NodeId IS NULL OR b.AllowReplay) AND (r.NodeId IS NULL OR r.AllowReplay) AS ReplayAllowed, f.Win, f.Replay IS NOT NULL AS ReplayExists FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId ORDER BY FightID DESC LIMIT ?, ?");
private static final Statement getPage = new Statement("SELECT f.FightID, f.GameMode, f.Server, f.StartTime, f.BlueLeader, f.RedLeader, (b.NodeId IS NULL OR b.AllowReplay) AND (r.NodeId IS NULL OR r.AllowReplay) AS ReplayAllowed, f.Win FROM Fight f LEFT OUTER JOIN SchematicNode b ON f.BlueSchem = b.NodeId LEFT OUTER JOIN SchematicNode r ON f.RedSchem = r.NodeId ORDER BY FightID DESC LIMIT ?, ?");
private final int fightID;
private final String gameMode;
@ -22,7 +22,6 @@ public class Fight {
private final int redLeader;
private final int win;
private final boolean replayExists;
private final boolean replayAllowed;
private final List<FightPlayer> bluePlayers = new ArrayList<>();
@ -37,7 +36,6 @@ public class Fight {
redLeader = rs.getInt("RedLeader");
replayAllowed = rs.getBoolean("ReplayAllowed");
win = rs.getInt("Win");
replayExists = rs.getBoolean("ReplayExists");
}
private void initPlayers(List<FightPlayer> fightPlayers) {
@ -118,6 +116,6 @@ public class Fight {
}
public boolean replayExists() {
return replayExists && getGameMode() != null;
return Replay.hasReplay(fightID) && getGameMode() != null;
}
}

Datei anzeigen

@ -0,0 +1,31 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bungeecore.sql;
import java.sql.ResultSet;
public class Replay {
private static final Statement hasReplay = new Statement("SELECT * FROM Replay WHERE id = ?");
public static boolean hasReplay(int id) {
return hasReplay.select(ResultSet::next, id);
}
}