diff --git a/pom.xml b/pom.xml
index 366e85f..922c88b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
at.pcgamingfreaks
Minepacks
- 2.0.8-RC2
+ 2.0.8-RC3
scm:git:git@github.com:GeorgH93/Minepacks.git
diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java
index b7637e5..b9d0fb3 100644
--- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java
+++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java
@@ -50,7 +50,7 @@ public abstract class Database implements Listener
protected final Minepacks plugin;
protected final InventorySerializer itsSerializer;
protected final boolean useUUIDs, bungeeCordMode;
- protected boolean useUUIDSeparators;
+ protected boolean useUUIDSeparators, asyncSave = true;
protected long maxAge;
private final Map backpacks = new ConcurrentHashMap<>();
private final UnCacheStrategie unCacheStrategie;
@@ -77,6 +77,7 @@ public void init()
public void close()
{
HandlerList.unregisterAll(this);
+ asyncSave = false;
backpacks.forEach((key, value) -> value.closeAll());
backpacks.clear();
unCacheStrategie.close();
diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java
index e6befd8..d0b6771 100644
--- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java
+++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/SQL.java
@@ -300,7 +300,7 @@ public void saveBackpack(final Backpack backpack)
final int id = backpack.getOwnerID(), usedSerializer = itsSerializer.getUsedSerializer();
final String nameOrUUID = getPlayerNameOrUUID(backpack.getOwner()), name = backpack.getOwner().getName();
- Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
+ Runnable runnable = () -> {
try(Connection connection = getConnection())
{
if(id <= 0)
@@ -335,7 +335,8 @@ public void saveBackpack(final Backpack backpack)
e.printStackTrace();
writeBackup(name, nameOrUUID, usedSerializer, data);
}
- });
+ };
+ if(asyncSave) Bukkit.getScheduler().runTaskAsynchronously(plugin, runnable); else runnable.run();
}
@Override