mirror of
https://github.com/geekfrog/PermissionsTime.git
synced 2024-11-21 14:58:48 +00:00
不再保存配置文件 语言整理
This commit is contained in:
parent
2523df87e1
commit
4b1b998237
@ -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_
|
||||
|
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>gg.frog.mc</groupId>
|
||||
<artifactId>permissionstime</artifactId>
|
||||
<version>0.2.2-SNAPSHOT</version>
|
||||
<version>0.2.3-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>PermissionsTime</name>
|
||||
<description>支持跨服的权限限时插件</description>
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 <playerName> \\n&8 - View player packages.");
|
||||
CMD_GIVE = getConfig().getString("cmd.give", "&6/{0} give <playerName> <packageName> <time> <timeUnit:d/h/m> \\n&8 - Give player package some time.(Time accumulation.) \\n&8 timeUnit: d=day, h=hour, m=minute");
|
||||
CMD_SET = getConfig().getString("cmd.set", "&6/{0} set <playerName> <packageName> <time> <timeUnit:d/h/m> \\n&8 - Set player package some time. \\n&8 timeUnit: d=day, h=hour, m=minute");
|
||||
CMD_REMOVE = getConfig().getString("cmd.remove", "&6/{0} remove <playerName> <packageName> [t/f] \\n&8 - Remove player package.(t: Delete global package.)");
|
||||
CMD_REMOVEALL = getConfig().getString("cmd.removeall", "&6/{0} removeall <playerName> [t/f] \\n&8 - Remove player all package.(t: Delete global packages.)");
|
||||
CMD_RELOAD = getConfig().getString("cmd.reload", "&6/{0} reload \\n&8 - Reloads the config file.");
|
||||
CMD_HELP = getConfig().getString("cmd.help", "/{0} help \\n&7 - Show commands.");
|
||||
CMD_ME = getConfig().getString("cmd.me", "&6/{0} me \\n&7 - View self package.");
|
||||
CMD_PACKAGES = getConfig().getString("cmd.packages", "&6/{0} packages [packageName] \\n&7 - View packages.");
|
||||
CMD_GET = getConfig().getString("cmd.get", "&6/{0} get <playerName> \\n&7 - View player packages.");
|
||||
CMD_GIVE = getConfig().getString("cmd.give", "&6/{0} give <playerName> <packageName> <time> <timeUnit:d/h/m> \\n&7 - Give player package some time. (Time accumulation.) \\n&7 timeUnit: d=day, h=hour, m=minute");
|
||||
CMD_SET = getConfig().getString("cmd.set", "&6/{0} set <playerName> <packageName> <time> <timeUnit:d/h/m> \\n&7 - Set player package some time. \\n&7 timeUnit: d=day, h=hour, m=minute");
|
||||
CMD_REMOVE = getConfig().getString("cmd.remove", "&6/{0} remove <playerName> <packageName> [t/f] \\n&7 - Remove player package. (t: Delete global package.)");
|
||||
CMD_REMOVEALL = getConfig().getString("cmd.removeall", "&6/{0} removeall <playerName> [t/f] \\n&7 - Remove player all package. (t: Delete global packages.)");
|
||||
CMD_RELOAD = getConfig().getString("cmd.reload", "&6/{0} reload \\n&7 - Reloads the config file.");
|
||||
}
|
||||
}
|
||||
|
@ -29,19 +29,7 @@ public class PluginCfg extends PluginConfig {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
getConfig().set("lang", "en");
|
||||
getConfig().set("metrics", true);
|
||||
getConfig().set("debug", false);
|
||||
getConfig().set("mysql.enable", false);
|
||||
getConfig().set("mysql.serverId", "default");
|
||||
getConfig().set("mysql.hostname", "localhost");
|
||||
getConfig().set("mysql.port", 3306);
|
||||
getConfig().set("mysql.database", "minecraft");
|
||||
getConfig().set("mysql.username", "user");
|
||||
getConfig().set("mysql.password", "123456");
|
||||
getConfig().set("mysql.tablePrefix", "pt_");
|
||||
}
|
||||
protected void init() {}
|
||||
|
||||
@Override
|
||||
protected void loadToDo() {
|
||||
|
@ -7,7 +7,7 @@ import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||
|
||||
public interface IPlayerDataDao {
|
||||
|
||||
static long TIME_UNIT = 60 * 1000L;// 分钟
|
||||
long TIME_UNIT = 60 * 1000L;// 分钟
|
||||
|
||||
/**
|
||||
* 检查表是否
|
||||
|
@ -12,7 +12,6 @@ public class FileUtil {
|
||||
|
||||
public interface FindFilesDo {
|
||||
boolean isProcess(String fileName);
|
||||
|
||||
void process(String fileName, InputStream is);
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@ import gg.frog.mc.permissionstime.database.IPlayerDataDao;
|
||||
|
||||
public class StrUtil {
|
||||
|
||||
private static String dfs = "yyyy/MM/dd HH:mm:ss";
|
||||
private static long dt = 24 * 60 * IPlayerDataDao.TIME_UNIT;
|
||||
private static long ht = 60 * IPlayerDataDao.TIME_UNIT;
|
||||
private static long mt = IPlayerDataDao.TIME_UNIT;
|
||||
private static final String dfs = "yyyy/MM/dd HH:mm:ss";
|
||||
private static final long dt = 24 * 60 * IPlayerDataDao.TIME_UNIT;
|
||||
private static final long ht = 60 * IPlayerDataDao.TIME_UNIT;
|
||||
private static final long mt = IPlayerDataDao.TIME_UNIT;
|
||||
|
||||
public static String messageFormat(String src, Object... args) {
|
||||
return MessageFormat.format(src, args).replace("&", "§").replace("\\n", "\n");
|
||||
|
@ -12,7 +12,6 @@ import gg.frog.mc.permissionstime.config.PluginCfg;
|
||||
|
||||
public class UpdateCheck implements Runnable {
|
||||
|
||||
private static final String pluginInfoUrl = "https://raw.githubusercontent.com/geekfrog/PermissionsTime/master/src/resources/plugin.yml";
|
||||
private PluginMain pm;
|
||||
|
||||
public UpdateCheck(PluginMain pm) {
|
||||
@ -22,6 +21,7 @@ public class UpdateCheck implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String pluginInfoUrl = "https://raw.githubusercontent.com/geekfrog/PermissionsTime/master/src/resources/plugin.yml";
|
||||
URL url = new URL(pluginInfoUrl);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
|
||||
@ -29,7 +29,9 @@ public class UpdateCheck implements Runnable {
|
||||
YamlConfiguration tempConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(connection.getInputStream(), Charsets.UTF_8));
|
||||
String version = tempConfig.getString("version", pm.PLUGIN_VERSION);
|
||||
if (!pm.PLUGIN_VERSION.equals(version)) {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "There is a new version ''{0}'' of the plugin.", version));
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&4There is a new version ''{0}'' of the plugin.", version));
|
||||
} else {
|
||||
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "&2No new version available."));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -151,9 +151,9 @@ public abstract class PluginConfig {
|
||||
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
|
||||
}
|
||||
loadToDo();
|
||||
if (tempConfig != null) {
|
||||
saveConfig();
|
||||
}
|
||||
// if (tempConfig != null) {
|
||||
// saveConfig();
|
||||
// }
|
||||
}
|
||||
|
||||
protected void saveObj(String path, Map<String, ? extends IConfigBean> o) {
|
||||
|
@ -1 +1,29 @@
|
||||
# 插件前缀.
|
||||
# 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'文件夹内.
|
||||
# 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
|
||||
database: minecraft
|
||||
username: user
|
||||
password: '123456'
|
||||
# 数据库表前缀
|
||||
# Database table prefix.
|
||||
tablePrefix: pt_
|
||||
|
@ -35,12 +35,12 @@ msg:
|
||||
unknownPackage: 'Unknown Packages'
|
||||
isExpirationDate: 'Your package: {0}({1})&r has expired.'
|
||||
cmd:
|
||||
help: '&6/{0} help \n&8 - Show commands.'
|
||||
me: '&6/{0} me \n&8 - View self package.'
|
||||
packages: '&6/{0} packages [packageName] \n&8 - View server packages.'
|
||||
get: '&6/{0} get <playerName> \n&8 - View player packages.'
|
||||
give: '&6/{0} give <playerName> <packageName> <time> <timeUnit:d/h/m> \n&8 - Give player package some time.(Time accumulation.) \n&8 timeUnit: d=day, h=hour, m=minute'
|
||||
set: '&6/{0} set <playerName> <packageName> <time> <timeUnit:d/h/m> \n&8 - Set player package some time. \n&8 timeUnit: d=day, h=hour, m=minute'
|
||||
remove: '&6/{0} remove <playerName> <packageName> [t/f] \n&8 - Remove player package.(t: Delete global package.)'
|
||||
removeall: '&6/{0} removeall <playerName> [t/f] \n&8 - Remove player all package.(t: Delete global packages.)'
|
||||
reload: '&6/{0} reload \n&8 - Reloads the config file.'
|
||||
help: '&6/{0} help \n&7 - Show commands.'
|
||||
me: '&6/{0} me \n&7 - View self package.'
|
||||
packages: '&6/{0} packages [packageName] \n&7 - View server packages.'
|
||||
get: '&6/{0} get <playerName> \n&7 - View player packages.'
|
||||
give: '&6/{0} give <playerName> <packageName> <time> <timeUnit:d/h/m> \n&7 - Give player package some time. (Time accumulation.) \n&7 timeUnit: d=day, h=hour, m=minute'
|
||||
set: '&6/{0} set <playerName> <packageName> <time> <timeUnit:d/h/m> \n&7 - Set player package some time. \n&7 timeUnit: d=day, h=hour, m=minute'
|
||||
remove: '&6/{0} remove <playerName> <packageName> [t/f] \n&7 - Remove player package. (t: Delete global package.)'
|
||||
removeall: '&6/{0} removeall <playerName> [t/f] \n&7 - Remove player all package. (t: Delete global packages.)'
|
||||
reload: '&6/{0} reload \n&7 - Reloads the config file.'
|
||||
|
@ -35,12 +35,12 @@ msg:
|
||||
unknownPackage: '未知权限包'
|
||||
isExpirationDate: '你的权限包: {0}({1})&r, 已到期.'
|
||||
cmd:
|
||||
help: '&6/{0} help \n&8 - 显示所有命令.'
|
||||
me: '&6/{0} me \n&8 - 显示自己的权限包.'
|
||||
packages: '&6/{0} packages [权限包名] \n&8 - 查看服务器的(某个)权限包.'
|
||||
get: '&6/{0} get <玩家> \n&8 - 查看玩家的权限包.'
|
||||
give: '&6/{0} give <玩家> <权限包名> <时间> <单位:d或h或m> \n&8 - 给玩家一定时间的权限包.(时间累加.) \n&8 时间单位: d=天, h=小时, m=分钟'
|
||||
set: '&6/{0} set <玩家> <权限包名> <时间> <单位:d或h或m> \n&8 - 重置玩家的权限包为一定时间. \n&8 时间单位: d=天, h=小时, m=分钟'
|
||||
remove: '&6/{0} remove <玩家> <权限包名> [t/f] \n&8 - 删除玩家的某个权限包.(t: 删除跨服权限包.)'
|
||||
removeall: '&6/{0} removeall <玩家> [t/f] \n&8 - 删除玩家所有的权限包.(t: 删除跨服权限包.)'
|
||||
reload: '&6/{0} reload \n&8 - 重新加载插件配置.'
|
||||
help: '&6/{0} help \n&7 - 显示所有命令.'
|
||||
me: '&6/{0} me \n&7 - 显示自己的权限包.'
|
||||
packages: '&6/{0} packages [权限包名] \n&7 - 查看服务器的(某个)权限包.'
|
||||
get: '&6/{0} get <玩家> \n&7 - 查看玩家的权限包.'
|
||||
give: '&6/{0} give <玩家> <权限包名> <时间> <单位:d或h或m> \n&7 - 给玩家一定时间的权限包. (时间累加.) \n&7 时间单位: d=天, h=小时, m=分钟'
|
||||
set: '&6/{0} set <玩家> <权限包名> <时间> <单位:d或h或m> \n&7 - 重置玩家的权限包为一定时间. \n&7 时间单位: d=天, h=小时, m=分钟'
|
||||
remove: '&6/{0} remove <玩家> <权限包名> [t/f] \n&7 - 删除玩家的某个权限包. (t: 删除跨服权限包.)'
|
||||
removeall: '&6/{0} removeall <玩家> [t/f] \n&7 - 删除玩家所有的权限包. (t: 删除跨服权限包.)'
|
||||
reload: '&6/{0} reload \n&7 - 重新加载插件配置.'
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: PermissionsTime
|
||||
version: 0.2.2-SNAPSHOT
|
||||
version: 0.2.3-SNAPSHOT
|
||||
main: gg.frog.mc.permissionstime.PluginMain
|
||||
author: GeekFrog
|
||||
softdepend:
|
||||
|
Loading…
Reference in New Issue
Block a user