diff --git a/README.md b/README.md index 777f5d5..443d094 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ### 支持跨服的权限限时插件 #### 构建地址:[http://ci.frog.gg/jenkins/job/PermissionsTime/](http://ci.frog.gg/jenkins/job/PermissionsTime/) +#### 前置插件SQLibrary下载地址:[https://dev.bukkit.org/projects/sqlibrary](https://dev.bukkit.org/projects/sqlibrary/) #### 已知问题(作者提醒): @@ -27,6 +28,7 @@ - **gui显示自己的权限包** - 手动删除过期的或无效数据 - 语言支持整理 +- 取消前置插件 - 支持分页? diff --git a/src/main/gg/frog/mc/permissionstime/PluginMain.java b/src/main/gg/frog/mc/permissionstime/PluginMain.java index 2d86468..fbe437d 100644 --- a/src/main/gg/frog/mc/permissionstime/PluginMain.java +++ b/src/main/gg/frog/mc/permissionstime/PluginMain.java @@ -62,10 +62,12 @@ public class PluginMain extends JavaPlugin { getServer().getScheduler().runTask(pm, new Runnable() { public void run() { if (!checkPluginDepends()) { + getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "启动失败!")); getServer().getPluginManager().disablePlugin(pm); } else { registerListeners(); registerCommands(); + getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "启动成功!")); } } }); diff --git a/src/main/gg/frog/mc/permissionstime/command/MainCommand.java b/src/main/gg/frog/mc/permissionstime/command/MainCommand.java index 41450a2..7080f41 100644 --- a/src/main/gg/frog/mc/permissionstime/command/MainCommand.java +++ b/src/main/gg/frog/mc/permissionstime/command/MainCommand.java @@ -29,7 +29,7 @@ public class MainCommand implements CommandExecutor { if (sender instanceof Player) { isPlayer = true; } - if (args[0].equalsIgnoreCase("help") || args.length == 0) { + if (args.length == 0 || args[0].equalsIgnoreCase("help")) { getHelp(sender, isPlayer); return true; } else { diff --git a/src/main/gg/frog/mc/permissionstime/database/SqlManager.java b/src/main/gg/frog/mc/permissionstime/database/SqlManager.java index cc7c67f..fc5b447 100644 --- a/src/main/gg/frog/mc/permissionstime/database/SqlManager.java +++ b/src/main/gg/frog/mc/permissionstime/database/SqlManager.java @@ -28,7 +28,7 @@ public class SqlManager { } public boolean updateDatabase() { - if (db != null && db.isOpen()) { + if (db != null) { db.close(); } if (PluginCfg.USE_MYSQL) { @@ -38,7 +38,7 @@ public class SqlManager { db = new SQLite(PluginMain.LOG, "[" + pm.PLUGIN_NAME + "] ", pm.getDataFolder().getAbsolutePath(), "playerData", ".db"); pds = new SqlitePlayerDataDao(pm, this); } - if(db.open()) { + if (db.open()) { try { if (!pds.tableExist()) { pds.creatTable(); diff --git a/src/main/gg/frog/mc/permissionstime/utils/database/DatabaseUtil.java b/src/main/gg/frog/mc/permissionstime/utils/database/DatabaseUtil.java index 9d311c3..5261471 100644 --- a/src/main/gg/frog/mc/permissionstime/utils/database/DatabaseUtil.java +++ b/src/main/gg/frog/mc/permissionstime/utils/database/DatabaseUtil.java @@ -1,5 +1,6 @@ package gg.frog.mc.permissionstime.utils.database; +import gg.frog.mc.permissionstime.config.PluginCfg; import gg.frog.mc.permissionstime.database.SqlManager; import lib.PatPeter.SQLibrary.Database; @@ -13,13 +14,15 @@ public abstract class DatabaseUtil { protected Database getDB() { Database db = sm.getDb(); - for (int i = 0; i < 3; i++) { - if (!db.isOpen()) { - if (db.open()) { + if (PluginCfg.USE_MYSQL) { + for (int i = 0; i < 3; i++) { + if (!db.isOpen()) { + if (db.open()) { + return db; + } + } else { return db; } - } else { - return db; } } return db;