diff --git a/pom.xml b/pom.xml
index c7b6f92..a82c362 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
net.seanomik
tamablefoxes
- 1.7.6-SNAPSHOT
+ 1.7.7-SNAPSHOT
jar
Tamablefoxes
@@ -44,7 +44,8 @@
- D:\Code\java\spigotPlugins\_TEST_SERVER_PAPER_1.16.2_\plugins\TamableFoxes_v${project.version}.jar
+
+ D:\Code\java\spigotPlugins\_TEST_SERVER_1.16.3_\plugins\TamableFoxes_v${project.version}.jar
false
diff --git a/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java b/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java
index 1f0c167..436604d 100644
--- a/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java
+++ b/src/main/java/net/seanomik/tamablefoxes/TamableFoxes.java
@@ -1,5 +1,8 @@
package net.seanomik.tamablefoxes;
+import net.seanomik.tamablefoxes.io.Config;
+import net.seanomik.tamablefoxes.io.sqlite.SQLiteHandler;
+import net.seanomik.tamablefoxes.io.sqlite.SQLiteHelper;
import net.seanomik.tamablefoxes.versions.NMSInterface;
import net.seanomik.tamablefoxes.versions.version_1_14_R1.NMSInterface_1_14_R1;
import net.seanomik.tamablefoxes.versions.version_1_15_R1.NMSInterface_1_15_R1;
@@ -12,11 +15,9 @@ import org.bukkit.plugin.java.JavaPlugin;
// @TODO:
-/* @CHANGELOG (1.7-SNAPSHOT):
- * Update to Minecraft 1.16.1.
- * This jar file will also work with Minecraft 1.14.X, 1.15.X, and 1.16.X.
- * Due to merging 1.14 support with all other versions, I also fixed SEVERAL issues that the versions for 1.14 had.
- * Foxes now sleep with their owner once again.
+/* @CHANGELOG (1.7.7-SNAPSHOT):
+ * Make foxes sleep on the bed with players, similar to what cats do.
+ * Add a configurable option to set the maximum about of foxes a player can tame.
*/
public final class TamableFoxes extends JavaPlugin implements Listener {
private static TamableFoxes plugin;
@@ -31,24 +32,34 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
LanguageConfig.getConfig().saveDefault();
+ // Verify server version
String version = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
- if (version.equals("v1_14_R1")) {
- nmsInterface = new NMSInterface_1_14_R1();
- } else if (version.equals("v1_15_R1")) {
- nmsInterface = new NMSInterface_1_15_R1();
- } else if (version.equals("v1_16_R1")) {
- nmsInterface = new NMSInterface_1_16_R1();
- } else if (version.equals("v1_16_R2")) {
- nmsInterface = new NMSInterface_1_16_R2();
- } else {
- Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getUnsupportedMCVersionRegister());
- versionSupported = false;
- return;
+ switch (version) {
+ case "v1_14_R1":
+ nmsInterface = new NMSInterface_1_14_R1();
+ break;
+ case "v1_15_R1":
+ nmsInterface = new NMSInterface_1_15_R1();
+ break;
+ case "v1_16_R1":
+ nmsInterface = new NMSInterface_1_16_R1();
+ break;
+ case "v1_16_R2":
+ nmsInterface = new NMSInterface_1_16_R2();
+ break;
+ default:
+ Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.RED + LanguageConfig.getUnsupportedMCVersionRegister());
+ versionSupported = false;
+ return;
}
- // Display starting message
+ // Display starting message then register entity.
Bukkit.getServer().getConsoleSender().sendMessage(Utils.getPrefix() + ChatColor.YELLOW + LanguageConfig.getMCVersionLoading(version));
nmsInterface.registerCustomFoxEntity();
+
+ if (Config.getMaxPlayerFoxTames() != 0) {
+ SQLiteHelper.getInstance().createTablesIfNotExist();
+ }
}
@Override
diff --git a/src/main/java/net/seanomik/tamablefoxes/Utils.java b/src/main/java/net/seanomik/tamablefoxes/Utils.java
index 145ff23..9938e9c 100644
--- a/src/main/java/net/seanomik/tamablefoxes/Utils.java
+++ b/src/main/java/net/seanomik/tamablefoxes/Utils.java
@@ -1,52 +1,51 @@
-package net.seanomik.tamablefoxes;
-
-import org.bukkit.ChatColor;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-
-public class Utils {
-
- public static String getPrefix() {
- return ChatColor.RED + "[Tamable Foxes] ";
- }
-
- public static Class> getPrivateInnerClass(Class outer, String innerName) {
- for (Class> declaredClass : outer.getDeclaredClasses()) {
- if (declaredClass.getSimpleName().equals(innerName)) return declaredClass;
- }
-
- return null;
- }
-
- public static Object instantiatePrivateInnerClass(Class outer, String innerName, Object outerObject, List