From ef4d53eb85a3ae07e72590615c22544c083f93ad Mon Sep 17 00:00:00 2001 From: Craftinators Date: Mon, 27 Feb 2023 12:57:12 -0500 Subject: [PATCH] fix: throw error if file isn't created --- .../hibiscusmc/hmccosmetics/database/types/SQLiteData.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/database/types/SQLiteData.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/database/types/SQLiteData.java index 3446576a..f97cc56a 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/database/types/SQLiteData.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/database/types/SQLiteData.java @@ -17,10 +17,12 @@ public class SQLiteData extends SQLData { @Override public void setup() { File dataFolder = new File(HMCCosmeticsPlugin.getInstance().getDataFolder(), "database.db"); + boolean exists = dataFolder.exists(); - if (!dataFolder.exists()){ + if (!exists) { try { - dataFolder.createNewFile(); + boolean created = dataFolder.createNewFile(); + if (!created) throw new IOException("File didn't exist but now does"); } catch (IOException e) { MessagesUtil.sendDebugMessages("File write error. Database will not work properly", Level.SEVERE); }