Properly fix startup on Linux

This commit is contained in:
Draycia 2020-01-26 02:09:34 -08:00
parent fc34a9e5dd
commit 88765de9d8
4 changed files with 12 additions and 13 deletions

View File

@ -54,6 +54,7 @@
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
<property name="restartRequiresConfirmation" value="false" />
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
<property name="settings.editor.selected.configurable" value="configurable.group.appearance" />
</component>
<component name="RecentsManager">
@ -64,13 +65,13 @@
</component>
<component name="RunManager" selected="JAR Application.Spigot-1.15.1">
<configuration name="Spigot-1.15.1" type="JarApplication">
<option name="JAR_PATH" value="$PROJECT_DIR$/../../_TEST_SERVER_1.15.1_/spigot-1.15.1.jar" />
<option name="JAR_PATH" value="$USER_HOME$/_TEST_SERVER_1.15.1_/spigot-1.15.1.jar" />
<option name="WORKING_DIRECTORY" value="D:\Code\java\spigotPlugins\_TEST_SERVER_1.15.1_" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />
</configuration>
<configuration default="true" type="JarApplication">
<option name="JAR_PATH" value="$PROJECT_DIR$/../../_TEST_SERVER_2_/spigot-1.15.1.jar" />
<option name="JAR_PATH" value="$USER_HOME$/_TEST_SERVER_2_/spigot-1.15.1.jar" />
<option name="WORKING_DIRECTORY" value="D:\Code\java\spigotPlugins\_TEST_SERVER_2_" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2" />

View File

@ -42,12 +42,13 @@ public final class TamableFoxes extends JavaPlugin implements Listener {
public List<EntityTamableFox> 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();

View File

@ -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 {

View File

@ -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.");