From fdd3641e2d98b75a2b085022793e5d94bf14525c Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Sun, 8 May 2022 15:48:18 -0400 Subject: [PATCH] Fix #79 --- .../tamablefoxes/util/io/sqlite/SQLiteHelper.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Utility/src/main/java/net/seanomik/tamablefoxes/util/io/sqlite/SQLiteHelper.java b/Utility/src/main/java/net/seanomik/tamablefoxes/util/io/sqlite/SQLiteHelper.java index 892c91d..5e41e9a 100644 --- a/Utility/src/main/java/net/seanomik/tamablefoxes/util/io/sqlite/SQLiteHelper.java +++ b/Utility/src/main/java/net/seanomik/tamablefoxes/util/io/sqlite/SQLiteHelper.java @@ -1,6 +1,5 @@ package net.seanomik.tamablefoxes.util.io.sqlite; -import net.seanomik.tamablefoxes.util.Utils; import net.seanomik.tamablefoxes.util.io.Config; import org.bukkit.plugin.Plugin; @@ -20,7 +19,7 @@ public class SQLiteHelper { public static SQLiteHelper getInstance(Plugin plugin) { if (instance == null) { instance = new SQLiteHelper(); - instance.plugin = plugin; + SQLiteHelper.plugin = plugin; } return instance; @@ -59,6 +58,8 @@ public class SQLiteHelper { } public int getPlayerFoxAmount(UUID uuid) { + sqLiteHandler = SQLiteHandler.getInstance(); + try { sqLiteHandler.connect(plugin); PreparedStatement statement = sqLiteHandler.getConnection() @@ -85,6 +86,8 @@ public class SQLiteHelper { } public void addPlayerFoxAmount(UUID uuid, int amt) { + sqLiteHandler = SQLiteHandler.getInstance(); + try { String query = "UPDATE " + userAmountTableName + " SET AMOUNT = AMOUNT + " + amt + " WHERE UUID = '" + uuid.toString() + "'"; if (getPlayerFoxAmount(uuid) == -1) { @@ -109,6 +112,8 @@ public class SQLiteHelper { } public void removePlayerFoxAmount(UUID uuid, int amt) { + sqLiteHandler = SQLiteHandler.getInstance(); + try { String query = "UPDATE " + userAmountTableName + " SET AMOUNT = AMOUNT - " + amt + " WHERE UUID = '" + uuid.toString() + "'";