Improve database error catching

Former-commit-id: 65bf0da5abcbcc97c11c7545bc5b1cd08b4d30aa
This commit is contained in:
sandtechnology committed 2020-03-08 11:48:12 +08:00
1 parent ca39ed6a8b
commit d4c75e6cd2
2 files changed
+12 -10

No files matched your search

@@ -19,13 +19,6 @@
package org.maxgamer.quickshop;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.sql.SQLException;
import java.util.*;
import java.util.Map.Entry;
import lombok.Getter;
import me.minebuilders.clearlag.Clearlag;
import me.minebuilders.clearlag.listeners.ItemMergeListener;
@@ -64,6 +57,14 @@ import org.maxgamer.quickshop.Util.Timer;
import org.maxgamer.quickshop.Util.ServerForkWrapper.SpigotWrapper;
import org.maxgamer.quickshop.Watcher.*;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.sql.SQLException;
import java.util.*;
import java.util.Map.Entry;
@Getter
public class QuickShop extends JavaPlugin {
@@ -594,8 +595,9 @@ public class QuickShop extends JavaPlugin {
/* Load 3rd party supports */
load3rdParty();
//Load the database
setupDBonEnableding = true;
setupDatabase(); // Load the database
setupDatabase();
setupDBonEnableding = false;
/* Initalize the tools */
@@ -864,7 +866,7 @@ public class QuickShop extends JavaPlugin {
getLogger().severe("Error connecting to the database.");
}
return false;
} catch (SQLException e) {
} catch (Throwable e) {
e.printStackTrace();
getServer().getPluginManager().disablePlugin(this);
if (setupDBonEnableding) {
@@ -570,7 +570,7 @@ public class ShopManager {
Util.debugLog("Disable the Tax for player " + p.getName() + " cause they have permission quickshop.tax");
}
if(tax >= 1.0){
plugin.getLogger().warning("Disable tax due to is invalid, it should be in 0.0-1.0 (now is "+tax+")");
plugin.getLogger().warning("Disable tax due to is invalid, it should be in 0.0-1.0 (current value is "+tax+")");
tax= 0;
}
if (tax < 0) {