diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 7ba6544..aa0aed9 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -54,6 +54,7 @@
+
@@ -64,13 +65,13 @@
-
+
-
+
diff --git a/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java b/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java
index 4c84a0f..4431972 100644
--- a/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java
+++ b/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java
@@ -42,12 +42,13 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
public List spawnedFoxes = new ArrayList<>();
public SQLiteSetterGetter sqLiteSetterGetter = new SQLiteSetterGetter();
- public SQLiteHandler sqLiteHandler = new SQLiteHandler();
+ public SQLiteHandler sqLiteHandler;
private boolean versionSupported = true;
@Override
public void onLoad() {
+ sqLiteHandler = new SQLiteHandler(getDataFolder());
plugin = this;
LanguageConfig.getConfig().saveDefault();
diff --git a/src/main/java/net/seanomik/tamablefoxes/Utils.java b/src/main/java/net/seanomik/tamablefoxes/Utils.java
index d451527..ab95e56 100644
--- a/src/main/java/net/seanomik/tamablefoxes/Utils.java
+++ b/src/main/java/net/seanomik/tamablefoxes/Utils.java
@@ -5,9 +5,6 @@ import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
public class Utils {
diff --git a/src/main/java/net/seanomik/tamablefoxes/pathfinding/FoxPathfinderGoalMeleeAttack.java b/src/main/java/net/seanomik/tamablefoxes/pathfinding/FoxPathfinderGoalMeleeAttack.java
index 968724c..490a7f4 100644
--- a/src/main/java/net/seanomik/tamablefoxes/pathfinding/FoxPathfinderGoalMeleeAttack.java
+++ b/src/main/java/net/seanomik/tamablefoxes/pathfinding/FoxPathfinderGoalMeleeAttack.java
@@ -1,6 +1,5 @@
package net.seanomik.tamablefoxes.pathfinding;
-import net.minecraft.server.v1_15_R1.EntityFox;
import net.minecraft.server.v1_15_R1.EntityLiving;
import net.minecraft.server.v1_15_R1.PathfinderGoalMeleeAttack;
import net.minecraft.server.v1_15_R1.SoundEffects;
diff --git a/src/main/java/net/seanomik/tamablefoxes/pathfinding/FoxPathfinderGoalOwnerHurtTarget.java b/src/main/java/net/seanomik/tamablefoxes/pathfinding/FoxPathfinderGoalOwnerHurtTarget.java
index 253710c..0ebbf61 100644
--- a/src/main/java/net/seanomik/tamablefoxes/pathfinding/FoxPathfinderGoalOwnerHurtTarget.java
+++ b/src/main/java/net/seanomik/tamablefoxes/pathfinding/FoxPathfinderGoalOwnerHurtTarget.java
@@ -1,14 +1,11 @@
package net.seanomik.tamablefoxes.pathfinding;
-import net.minecraft.server.v1_15_R1.EntityTameableAnimal;
import net.seanomik.tamablefoxes.EntityTamableFox;
import net.minecraft.server.v1_15_R1.EntityLiving;
import net.minecraft.server.v1_15_R1.PathfinderGoalTarget;
import net.minecraft.server.v1_15_R1.PathfinderTargetCondition;
-import net.seanomik.tamablefoxes.Utils;
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
-import javax.rmi.CORBA.Util;
import java.util.EnumSet;
public class FoxPathfinderGoalOwnerHurtTarget extends PathfinderGoalTarget {
diff --git a/src/main/java/net/seanomik/tamablefoxes/sqlite/SQLiteHandler.java b/src/main/java/net/seanomik/tamablefoxes/sqlite/SQLiteHandler.java
index a65d440..5f8b35f 100644
--- a/src/main/java/net/seanomik/tamablefoxes/sqlite/SQLiteHandler.java
+++ b/src/main/java/net/seanomik/tamablefoxes/sqlite/SQLiteHandler.java
@@ -1,21 +1,21 @@
package net.seanomik.tamablefoxes.sqlite;
-import net.seanomik.tamablefoxes.TamableFoxes;
-import org.bukkit.Bukkit;
-
+import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class SQLiteHandler {
private Connection connection;
+ private File dataFolder;
+
+ public SQLiteHandler(File dataFolder) {
+ this.dataFolder = dataFolder;
+ }
public void connect() {
try {
- String baseLoc = Bukkit.getWorldContainer().toURI().toString().substring(6);
- baseLoc = baseLoc.substring(0,baseLoc.length()-2);
-
- String url = "jdbc:sqlite:" + baseLoc + "plugins/TamableFoxes/foxes.db";
+ String url = "jdbc:sqlite:/" + dataFolder.getAbsolutePath() + "/foxes.db";
connection = DriverManager.getConnection(url);
//Bukkit.getConsoleSender().sendMessage(TamableFoxes.getPrefix() + "Connection to SQLite has been established.");
diff --git a/src/main/java/net/seanomik/tamablefoxes/sqlite/SQLiteSetterGetter.java b/src/main/java/net/seanomik/tamablefoxes/sqlite/SQLiteSetterGetter.java
index 653ff16..5ff2b21 100644
--- a/src/main/java/net/seanomik/tamablefoxes/sqlite/SQLiteSetterGetter.java
+++ b/src/main/java/net/seanomik/tamablefoxes/sqlite/SQLiteSetterGetter.java
@@ -1,23 +1,12 @@
package net.seanomik.tamablefoxes.sqlite;
-import net.minecraft.server.v1_15_R1.EntityFox;
import net.minecraft.server.v1_15_R1.EntityLiving;
-import net.minecraft.server.v1_15_R1.EnumItemSlot;
import net.seanomik.tamablefoxes.EntityTamableFox;
import net.seanomik.tamablefoxes.TamableFoxes;
import net.seanomik.tamablefoxes.Utils;
import net.seanomik.tamablefoxes.io.LanguageConfig;
-import org.apache.commons.lang.ObjectUtils;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
-import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
-import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;