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/)
#### 前置插件SQLibrary下载地址:[https://dev.bukkit.org/projects/sqlibrary](https://dev.bukkit.org/projects/sqlibrary/)
#### 已知问题(作者提醒):
@ -27,6 +28,7 @@
- **gui显示自己的权限包**
- 手动删除过期的或无效数据
- 语言支持整理
- 取消前置插件
- 支持分页?

View File

@ -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 + "启动成功!"));
}
}
});

View File

@ -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 {

View File

@ -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();

View File

@ -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;