From f8e9b32c0bd0fd36398b30ef9c678ea5057ff6f3 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 31 Dec 2025 17:31:28 +0000 Subject: [PATCH] fix: trial synchronising SQLManager#sendBatch - I don't think this is likely to cause any issues; I don't see any reason for deadlocks/excessive waits here - attempts to address #4612 - this is the only reason I can find that there would be some kind of race condition that sets auto commit whilst attempting to commit from the main thread and would also explain why we get the NoSuchElementException in the above issue as well --- .../main/java/com/plotsquared/core/database/SQLManager.java | 2 +- Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java index 63d1af450..bd017184f 100644 --- a/Core/src/main/java/com/plotsquared/core/database/SQLManager.java +++ b/Core/src/main/java/com/plotsquared/core/database/SQLManager.java @@ -389,7 +389,7 @@ public class SQLManager implements AbstractDB { } } - public boolean sendBatch() { + public synchronized boolean sendBatch() { try { if (!getGlobalTasks().isEmpty()) { if (this.connection.getAutoCommit()) { diff --git a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java index 47679888e..5b66cb059 100644 --- a/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java +++ b/Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java @@ -391,8 +391,7 @@ public abstract class PlotPlayer

implements CommandCaller, OfflinePlotPlayer, int count = 0; for (PlotArea area : this.plotAreaManager.getPlotAreasSet(world)) { if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { - count += - area.getPlotsAbs(uuid).stream().filter(plot -> !DoneFlag.isDone(plot)).count(); + count += area.getPlotsAbs(uuid).stream().filter(plot -> !DoneFlag.isDone(plot)).count(); } else { count += area.getPlotsAbs(uuid).size(); }