Fix a crash on some machines

This commit is contained in:
SeanOMik 2020-11-02 18:08:54 -06:00
parent 90b565131a
commit 9ef4aafb55
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
3 changed files with 6 additions and 7 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.seanomik</groupId> <groupId>net.seanomik</groupId>
<artifactId>tamablefoxes</artifactId> <artifactId>tamablefoxes</artifactId>
<version>1.7.8-SNAPSHOT</version> <version>1.7.9-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Tamablefoxes</name> <name>Tamablefoxes</name>

View File

@ -15,8 +15,8 @@ import org.bukkit.plugin.java.JavaPlugin;
// @TODO: // @TODO:
/* @CHANGELOG (1.7.8-SNAPSHOT): /* @CHANGELOG (1.7.9-SNAPSHOT):
* Add a permission to allow players to bypass the tame limit. * Fix some crashes and errors with the sqlite database failing to be found.
*/ */
public final class TamableFoxes extends JavaPlugin implements Listener { public final class TamableFoxes extends JavaPlugin implements Listener {
private static TamableFoxes plugin; private static TamableFoxes plugin;

View File

@ -1,5 +1,6 @@
package net.seanomik.tamablefoxes.io.sqlite; package net.seanomik.tamablefoxes.io.sqlite;
import net.seanomik.tamablefoxes.TamableFoxes;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import java.sql.Connection; import java.sql.Connection;
@ -21,10 +22,8 @@ public class SQLiteHandler {
public void connect() { public void connect() {
try { try {
String baseLoc = Bukkit.getWorldContainer().toURI().toString().substring(6); String pluginFolder = TamableFoxes.getPlugin().getDataFolder().getAbsolutePath();
baseLoc = baseLoc.substring(0,baseLoc.length()-2); String url = "jdbc:sqlite:" + pluginFolder + "/userFoxAmount.db";
String url = "jdbc:sqlite:" + baseLoc + "plugins/Tamablefoxes/userFoxAmount.db";
connection = DriverManager.getConnection(url); connection = DriverManager.getConnection(url);
} catch (SQLException e) { } catch (SQLException e) {