From 4b1b998237e4b412a6ea8423d775d49e14e3d7cf Mon Sep 17 00:00:00 2001 From: GeekFrog Date: Thu, 27 Jul 2017 01:13:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=86=8D=E4=BF=9D=E5=AD=98=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=20=E8=AF=AD=E8=A8=80=E6=95=B4?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.yml | 16 ++++++++--- pom.xml | 2 +- .../frog/mc/permissionstime/PluginMain.java | 2 +- .../permissionstime/command/MainCommand.java | 1 - .../permissionstime/config/ConfigManager.java | 7 +++-- .../mc/permissionstime/config/LangCfg.java | 18 ++++++------ .../mc/permissionstime/config/PluginCfg.java | 14 +--------- .../database/IPlayerDataDao.java | 2 +- .../mc/permissionstime/utils/FileUtil.java | 1 - .../mc/permissionstime/utils/StrUtil.java | 8 +++--- .../mc/permissionstime/utils/UpdateCheck.java | 6 ++-- .../utils/config/PluginConfig.java | 6 ++-- src/resources/config.yml | 28 +++++++++++++++++++ src/resources/lang/en.yml | 18 ++++++------ src/resources/lang/zh-cn.yml | 18 ++++++------ src/resources/plugin.yml | 2 +- 16 files changed, 88 insertions(+), 61 deletions(-) diff --git a/config/config.yml b/config/config.yml index 3d7a4b2..14760b0 100644 --- a/config/config.yml +++ b/config/config.yml @@ -1,16 +1,23 @@ -# 插件提示前缀. -pluginPrefix: '&4[&b限时权限&4]' +# 插件前缀. +# Plugin prefix. +pluginPrefix: '&4[&bPermissions Time&4] ' # 是否开启DEBUG模式. +# Whether to open the DEBUG mode. debug: false -# 是否同意插件统计信息. +# 是否同意插件上传统计信息. +# Whether or not you agree with the plugin to upload statistics. metrics: true # 语言文件名称 在'lang'文件夹内. -lang: zh-cn +# Language file name. +lang: en # 数据库相关. +# Database settings. mysql: # 是否使用MySQL数据库. + # Whether to use the MySQL database. enable: false # 服务器唯一标识, 用来区分权限是哪个服务器的. + # Server ID. serverId: default hostname: localhost port: 3306 @@ -18,4 +25,5 @@ mysql: username: user password: '123456' # 数据库表前缀 + # Database table prefix. tablePrefix: pt_ diff --git a/pom.xml b/pom.xml index c28d910..0791668 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 gg.frog.mc permissionstime - 0.2.2-SNAPSHOT + 0.2.3-SNAPSHOT jar PermissionsTime 支持跨服的权限限时插件 diff --git a/src/main/gg/frog/mc/permissionstime/PluginMain.java b/src/main/gg/frog/mc/permissionstime/PluginMain.java index 3c6f3b1..2df511f 100644 --- a/src/main/gg/frog/mc/permissionstime/PluginMain.java +++ b/src/main/gg/frog/mc/permissionstime/PluginMain.java @@ -26,7 +26,7 @@ public class PluginMain extends JavaPlugin { public String PLUGIN_VERSION; public String PLUGIN_NAME_LOWER_CASE; public static final String DEPEND_PLUGIN = "SQLibrary,Vault"; - public static Logger LOG = Logger.getLogger("Minecraft"); + public static final Logger LOG = Logger.getLogger("Minecraft"); private ConfigManager cm = null; private PluginMain pm = null; diff --git a/src/main/gg/frog/mc/permissionstime/command/MainCommand.java b/src/main/gg/frog/mc/permissionstime/command/MainCommand.java index ac80fb8..9672620 100644 --- a/src/main/gg/frog/mc/permissionstime/command/MainCommand.java +++ b/src/main/gg/frog/mc/permissionstime/command/MainCommand.java @@ -145,7 +145,6 @@ public class MainCommand implements CommandExecutor, TabCompleter { if (!isPlayer || sender.isOp() || sender.hasPermission(pm.PLUGIN_NAME_LOWER_CASE + ".reload")) { sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_RELOAD, pm.PLUGIN_NAME_LOWER_CASE)); } - sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX)); } private boolean hasPermission(CommandSender sender, boolean isPlayer, String permissionPath) { diff --git a/src/main/gg/frog/mc/permissionstime/config/ConfigManager.java b/src/main/gg/frog/mc/permissionstime/config/ConfigManager.java index e66047f..940114e 100644 --- a/src/main/gg/frog/mc/permissionstime/config/ConfigManager.java +++ b/src/main/gg/frog/mc/permissionstime/config/ConfigManager.java @@ -74,8 +74,11 @@ public class ConfigManager { @Override public boolean isProcess(String fileName) { - if (fileName.matches("lang/.+\\.yml")) { - return true; + if (fileName.matches("lang/.+\\.yml") || "config.yml".equals(fileName) || "packages.yml".equals(fileName)) { + File f = new File(pm.getDataFolder(), fileName); + if (!f.exists()) { + return true; + } } return false; } diff --git a/src/main/gg/frog/mc/permissionstime/config/LangCfg.java b/src/main/gg/frog/mc/permissionstime/config/LangCfg.java index fbe1489..4b88b48 100644 --- a/src/main/gg/frog/mc/permissionstime/config/LangCfg.java +++ b/src/main/gg/frog/mc/permissionstime/config/LangCfg.java @@ -104,14 +104,14 @@ public class LangCfg extends PluginConfig { MSG_UNKNOWN_PACKAGE = getConfig().getString("msg.unknownPackage", "Unknown Packages"); MSG_IS_EXPIRATION_DATE = getConfig().getString("msg.isExpirationDate", "Your package: {0}({1})&r has expired."); - CMD_HELP = getConfig().getString("cmd.help", "/{0} help -Show commands."); - CMD_ME = getConfig().getString("cmd.me", "&6/{0} me \\n&8 - View self package."); - CMD_PACKAGES = getConfig().getString("cmd.packages", "&6/{0} packages [packageName] \\n&8 - View packages."); - CMD_GET = getConfig().getString("cmd.get", "&6/{0} get \\n&8 - View player packages."); - CMD_GIVE = getConfig().getString("cmd.give", "&6/{0} give