1
1
mirror of https://github.com/geekfrog/PermissionsTime.git synced 2024-11-25 09:58:50 +00:00

低版本兼容 fix bug

This commit is contained in:
GeekFrog 2017-07-16 10:38:19 +08:00
parent 277d091ce7
commit 27f573c26b
5 changed files with 15 additions and 8 deletions

View File

@ -2,6 +2,7 @@
### 支持跨服的权限限时插件 ### 支持跨服的权限限时插件
#### 构建地址:[http://ci.frog.gg/jenkins/job/PermissionsTime/](http://ci.frog.gg/jenkins/job/PermissionsTime/) #### 构建地址:[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显示自己的权限包** - **gui显示自己的权限包**
- 手动删除过期的或无效数据 - 手动删除过期的或无效数据
- 语言支持整理 - 语言支持整理
- 取消前置插件
- 支持分页? - 支持分页?

View File

@ -62,10 +62,12 @@ public class PluginMain extends JavaPlugin {
getServer().getScheduler().runTask(pm, new Runnable() { getServer().getScheduler().runTask(pm, new Runnable() {
public void run() { public void run() {
if (!checkPluginDepends()) { if (!checkPluginDepends()) {
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "启动失败!"));
getServer().getPluginManager().disablePlugin(pm); getServer().getPluginManager().disablePlugin(pm);
} else { } else {
registerListeners(); registerListeners();
registerCommands(); registerCommands();
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "启动成功!"));
} }
} }
}); });

View File

@ -29,7 +29,7 @@ public class MainCommand implements CommandExecutor {
if (sender instanceof Player) { if (sender instanceof Player) {
isPlayer = true; isPlayer = true;
} }
if (args[0].equalsIgnoreCase("help") || args.length == 0) { if (args.length == 0 || args[0].equalsIgnoreCase("help")) {
getHelp(sender, isPlayer); getHelp(sender, isPlayer);
return true; return true;
} else { } else {

View File

@ -28,7 +28,7 @@ public class SqlManager {
} }
public boolean updateDatabase() { public boolean updateDatabase() {
if (db != null && db.isOpen()) { if (db != null) {
db.close(); db.close();
} }
if (PluginCfg.USE_MYSQL) { if (PluginCfg.USE_MYSQL) {
@ -38,7 +38,7 @@ public class SqlManager {
db = new SQLite(PluginMain.LOG, "[" + pm.PLUGIN_NAME + "] ", pm.getDataFolder().getAbsolutePath(), "playerData", ".db"); db = new SQLite(PluginMain.LOG, "[" + pm.PLUGIN_NAME + "] ", pm.getDataFolder().getAbsolutePath(), "playerData", ".db");
pds = new SqlitePlayerDataDao(pm, this); pds = new SqlitePlayerDataDao(pm, this);
} }
if(db.open()) { if (db.open()) {
try { try {
if (!pds.tableExist()) { if (!pds.tableExist()) {
pds.creatTable(); pds.creatTable();

View File

@ -1,5 +1,6 @@
package gg.frog.mc.permissionstime.utils.database; package gg.frog.mc.permissionstime.utils.database;
import gg.frog.mc.permissionstime.config.PluginCfg;
import gg.frog.mc.permissionstime.database.SqlManager; import gg.frog.mc.permissionstime.database.SqlManager;
import lib.PatPeter.SQLibrary.Database; import lib.PatPeter.SQLibrary.Database;
@ -13,6 +14,7 @@ public abstract class DatabaseUtil {
protected Database getDB() { protected Database getDB() {
Database db = sm.getDb(); Database db = sm.getDb();
if (PluginCfg.USE_MYSQL) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (!db.isOpen()) { if (!db.isOpen()) {
if (db.open()) { if (db.open()) {
@ -22,6 +24,7 @@ public abstract class DatabaseUtil {
return db; return db;
} }
} }
}
return db; return db;
} }
} }