diff --git a/FoxCore b/FoxCore index ecf0963..5abc01d 160000 --- a/FoxCore +++ b/FoxCore @@ -1 +1 @@ -Subproject commit ecf0963951fed0c2aa52a850df251295cda68729 +Subproject commit 5abc01dba30683d567f620be397fe4958127a86b diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FGStorageManager.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FGStorageManager.java index ff976a7..d403c0f 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FGStorageManager.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/FGStorageManager.java @@ -122,10 +122,18 @@ public synchronized void loadHandlers() { metaSet.getString("TYPE").equalsIgnoreCase(handlerDataSet.getString("TYPE")) && metaSet.getInt("PRIORITY") == handlerDataSet.getInt("PRIORITY") && metaSet.getBoolean("ENABLED") == handlerDataSet.getBoolean("ENABLED")) { - FGManager.getInstance().addHandler( - FGFactoryManager.getInstance().createHandler( - source, handlerDataSet.getString("NAME"), handlerDataSet.getString("TYPE"), - handlerDataSet.getInt("PRIORITY"), handlerDataSet.getBoolean("ENABLED"))); + IHandler handler = FGFactoryManager.getInstance().createHandler( + source, + handlerDataSet.getString("NAME"), + handlerDataSet.getString("TYPE"), + handlerDataSet.getInt("PRIORITY"), + handlerDataSet.getBoolean("ENABLED") + ); + if (handler != null) { + FoxGuardMain.instance().logger().info("Loaded handler \"" + handler.getName() + + "\" of type \"" + handler.getLongTypeName() +"\""); + } + FGManager.getInstance().addHandler(handler); } else if (FGConfigManager.getInstance().forceLoad()) { FoxGuardMain.instance().logger().info("Mismatched database found. Attempting force load..."); if (metaSet.getString("CATEGORY").equalsIgnoreCase("region")) { @@ -210,13 +218,16 @@ public synchronized void loadWorldRegions(World world) { metaSet.getString("TYPE").equalsIgnoreCase(regionDataSet.getString("TYPE")) && metaSet.getString("WORLD").equals(world.getName()) && metaSet.getBoolean("ENABLED") == regionDataSet.getBoolean("ENABLED")) { - FGManager.getInstance().addRegion(world, - FGFactoryManager.getInstance().createRegion( - source, - regionDataSet.getString("NAME"), regionDataSet.getString("TYPE"), - regionDataSet.getBoolean("ENABLED") - ) + IRegion region = FGFactoryManager.getInstance().createRegion( + source, + regionDataSet.getString("NAME"), regionDataSet.getString("TYPE"), + regionDataSet.getBoolean("ENABLED") ); + if (region != null) { + FoxGuardMain.instance().logger().info("Loaded region \"" + region.getName() + + "\" of type \"" + region.getLongTypeName() + "\""); + } + FGManager.getInstance().addRegion(world, region); } else if (FGConfigManager.getInstance().forceLoad()) { FoxGuardMain.instance().logger().info("Mismatched database found. Attempting force load..."); if (metaSet.getString("CATEGORY").equalsIgnoreCase("region")) { @@ -642,6 +653,7 @@ public synchronized void resolveDeferredObjects() { public synchronized void loadGlobalHandler() { Server server = Sponge.getGame().getServer(); try { + FoxGuardMain.instance().logger().info("Loading global handler"); FGManager.getInstance().getGlobalHandler().loadFromDatabase(FoxGuardMain.instance().getDataSource( "jdbc:h2:" + Sponge.getGame().getSavesDirectory().resolve(server.getDefaultWorldName()) + "/foxguard/handlers/" + GlobalHandler.NAME )); diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GlobalHandler.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GlobalHandler.java index c277fc5..9c4e94a 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GlobalHandler.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/handler/GlobalHandler.java @@ -232,8 +232,7 @@ public void loadFromDatabase(DataSource dataSource) throws SQLException { try (Connection conn = dataSource.getConnection()) { CallbackHashMap flagMap = new CallbackHashMap<>((key, map) -> Tristate.UNDEFINED); try (Statement statement = conn.createStatement()) { - statement.execute("CREATE TABLE IF NOT EXISTS FLAGMAP(KEY VARCHAR (256), VALUE VARCHAR (256));" + - "DELETE FROM FLAGMAP;"); + statement.execute("CREATE TABLE IF NOT EXISTS FLAGMAP(KEY VARCHAR (256), VALUE VARCHAR (256));"); try (ResultSet mapEntrySet = statement.executeQuery("SELECT * FROM FLAGMAP")) { while (mapEntrySet.next()) { try { diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/state/HandlersStateField.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/state/HandlersStateField.java index c2b585e..f820898 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/state/HandlersStateField.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/state/HandlersStateField.java @@ -73,7 +73,7 @@ public ProcessResult modify(CommandSource source, String arguments) throws Comma } else if (parse.args[0].equalsIgnoreCase("remove")) { return remove(source, newArgs); } - return ProcessResult.of(false, Text.of("Not a valid")); + return ProcessResult.of(false, Text.of("Not a valid handler state command!")); } @Override diff --git a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/state/RegionsStateField.java b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/state/RegionsStateField.java index d00ba92..087edfc 100644 --- a/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/state/RegionsStateField.java +++ b/src/main/java/net/foxdenstudio/sponge/foxguard/plugin/state/RegionsStateField.java @@ -90,7 +90,7 @@ public ProcessResult modify(CommandSource source, String arguments) throws Comma } else if (parse.args[0].equalsIgnoreCase("remove")) { return remove(source, newArgs); } - return ProcessResult.of(false, Text.of("Not a valid")); + return ProcessResult.of(false, Text.of("Not a valid region state command!")); } @Override