Ranked #333
@ -32,14 +32,18 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class FightEndsHandler implements SpigotHandler {
|
||||
|
||||
private Map<String, List<Game>> gameModeGames = new HashMap<>();
|
||||
private Map<String, LinkedList<Game>> gameModeGames = new HashMap<>();
|
||||
|
||||
private int K = 20;
|
||||
|
||||
private long defaultFightRange = 1000 /* Milliseconds */ * 60 /* Seconds */ * 15L /* Minutes */;
|
||||
private Map<String, Long> fightRanges = new HashMap<>();
|
||||
private long defaultFightCount = 1;
|
||||
private Map<String, Long> fightCounts = new HashMap<>();
|
||||
|
||||
{
|
||||
fightRanges.put("miniwargear", 1000 /* Milliseconds */ * 60 /* Seconds */ * 10L /* Minutes */);
|
||||
fightRanges.put("miniwargear", 1000 /* Milliseconds */ * 60 /* Seconds */ * 30L /* Minutes */);
|
||||
fightCounts.put("miniwargear", 3L);
|
||||
}
|
||||
|
||||
Lixfel markierte diese Unterhaltung als gelöst
Veraltet
|
||||
@Override
|
||||
@ -73,6 +77,8 @@ public class FightEndsHandler implements SpigotHandler {
|
||||
blueResult = 0;
|
||||
}
|
||||
|
||||
// Die nächsten Zeilen filtern ein Fight innerhalb eines Teams nicht gewertet wird, bzw auch wenn nur Teile beider Teams im
|
||||
// gleichen Team sind dieser ungewertet ist.
|
||||
Set<Integer> teamsIds = fightEndsPacket.getBluePlayers().stream().map(SteamwarUser::get).map(SteamwarUser::getTeam).collect(Collectors.toSet());
|
||||
for (int redPlayer : fightEndsPacket.getRedPlayers()) {
|
||||
if (teamsIds.contains(SteamwarUser.get(redPlayer).getTeam())) {
|
||||
@ -85,7 +91,7 @@ public class FightEndsHandler implements SpigotHandler {
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
gameModeGames.computeIfAbsent(fightEndsPacket.getGameMode(), s -> new ArrayList<>()).add(new Game(fightEndsPacket.getBluePlayers(), fightEndsPacket.getRedPlayers()));
|
||||
gameModeGames.computeIfAbsent(fightEndsPacket.getGameMode(), s -> new LinkedList<>()).add(new Game(fightEndsPacket.getBluePlayers(), fightEndsPacket.getRedPlayers()));
|
||||
}
|
||||
|
||||
int blueSchemElo = SchemElo.getElo(fightEndsPacket.getBlueSchem());
|
||||
@ -126,7 +132,7 @@ public class FightEndsHandler implements SpigotHandler {
|
||||
List<Game> games = gameModeGames.get(gameMode);
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Hier bitte stattdessen verunden. Hier bitte stattdessen verunden.
|
||||
long lifetime = fightRanges.getOrDefault(gameMode, defaultFightRange);
|
||||
games.removeIf(game -> game.livedMillis() > lifetime);
|
||||
return games.stream().anyMatch(game -> game.isSame(bluePlayers, redPlayers));
|
||||
return games.stream().filter(game -> game.isSame(bluePlayers, redPlayers)).count() > fightCounts.getOrDefault(gameMode, defaultFightCount);
|
||||
}
|
||||
|
||||
@RequiredArgsConstructor
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Du musst das Processing in einen Task auslagern (dauert zu lange, insbesondere mit dem ganzen Fight-Gedöns).
Machst du das nicht seit dem DB update (da dispatched du doch auch die plugin messages async)