mirror of
https://github.com/geekfrog/PermissionsTime.git
synced 2025-09-06 11:06:58 +00:00
不再保存配置文件 语言整理
This commit is contained in:
@ -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) {
|
||||
|
Reference in New Issue
Block a user