Fix saving after unlock

This commit is contained in:
Stijn 2022-06-06 21:48:29 +02:00
parent 49bbf4fe1b
commit f167e43d4b
2 changed files with 21 additions and 20 deletions

View File

@ -20,6 +20,9 @@ public class LogoutEvent implements Listener {
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
UUID uuid = event.getPlayer().getUniqueId(); UUID uuid = event.getPlayer().getUniqueId();
new BukkitRunnable() {
@Override
public void run() {
if (Config.DEBUG) if (Config.DEBUG)
Logger.info("Syncing %", event.getPlayer().getName()); Logger.info("Syncing %", event.getPlayer().getName());
GUI.GUIByUUID.remove(uuid); GUI.GUIByUUID.remove(uuid);
@ -35,4 +38,6 @@ public class LogoutEvent implements Listener {
"villagerui:player-data", "villagerui:player-data",
out.toByteArray()); out.toByteArray());
} }
}.runTaskAsynchronously(VillagerUI.getInstance());
}
} }

View File

@ -58,13 +58,9 @@ public class EconUser {
uuid.toString(), getPointsMap().object2ObjectEntrySet().stream() uuid.toString(), getPointsMap().object2ObjectEntrySet().stream()
.map(entry -> entry.getKey() + " - " + entry.getValue().toString()) .map(entry -> entry.getKey() + " - " + entry.getValue().toString())
.collect(Collectors.joining("\n"))); .collect(Collectors.joining("\n")));
new BukkitRunnable() {
@Override
public void run() {
Queries.updateUserPoints(uuid, pointsMap); Queries.updateUserPoints(uuid, pointsMap);
} }
}.runTaskAsynchronously(VillagerUI.getInstance());
}
private void removePoints(String villagerType, int points, int remove) private void removePoints(String villagerType, int points, int remove)
{ {