From 69d1f829d3afadae1b085a8708b451c8f55f1b61 Mon Sep 17 00:00:00 2001 From: games647 Date: Sat, 22 Jul 2017 07:39:58 +0200 Subject: [PATCH] Ignore not loaded player accounts on save (Fixes #205) --- .../com/github/games647/scoreboardstats/pvpstats/Database.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/github/games647/scoreboardstats/pvpstats/Database.java b/src/main/java/com/github/games647/scoreboardstats/pvpstats/Database.java index 0a03beeb..c8925d68 100644 --- a/src/main/java/com/github/games647/scoreboardstats/pvpstats/Database.java +++ b/src/main/java/com/github/games647/scoreboardstats/pvpstats/Database.java @@ -173,11 +173,13 @@ public void saveAsync(PlayerStats stats) { public void save(List stats) { if (stats != null && dataSource != null) { update(stats.stream() + .filter(Objects::nonNull) .filter(PlayerStats::isModified) .filter(stat -> !stat.isNew()) .collect(Collectors.toList())); insert(stats.stream() + .filter(Objects::nonNull) .filter(PlayerStats::isModified) .filter(PlayerStats::isNew) .collect(Collectors.toList()));