1
0
mirror of https://e.coding.net/circlecloud/Residence.git synced 2024-10-31 22:38:48 +00:00

transport some language in console...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-05-30 22:18:40 +08:00
parent dfd79af897
commit bb10473fcc

View File

@ -17,7 +17,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
@ -237,7 +236,7 @@ public class Residence extends JavaPlugin {
public void run() {
rentmanager.checkCurrentRents();
if (cmanager.showIntervalMessages()) {
System.out.println("[Residence] - Rent Expirations checked!");
getLog().info(" - Rent Expirations checked!");
}
}
};
@ -247,7 +246,7 @@ public class Residence extends JavaPlugin {
public void run() {
leasemanager.doExpirations();
if (cmanager.showIntervalMessages()) {
System.out.println("[Residence] - Lease Expirations checked!");
getLog().info(" - Lease Expirations checked!");
}
}
};
@ -260,7 +259,7 @@ public class Residence extends JavaPlugin {
saveYml();
}
} catch (Exception ex) {
Logger.getLogger("Minecraft").log(Level.SEVERE, "[Residence] 插件数据 保存 错误", ex);
getLog().warning("领地数据保存错误,可能造成部分领地丢失,请尝试恢复备份文件!");
}
}
};
@ -268,8 +267,7 @@ public class Residence extends JavaPlugin {
public Residence() {
}
private boolean checkNewLanguageVersion(String lang) throws IOException, FileNotFoundException,
InvalidConfigurationException {
private boolean checkNewLanguageVersion(String lang) throws IOException, FileNotFoundException, InvalidConfigurationException {
File outFile = new File(new File(this.getDataFolder(), "Language"), lang + ".yml");
File checkFile = new File(new File(this.getDataFolder(), "Language"), "temp-" + lang
+ ".yml");
@ -309,26 +307,33 @@ public class Residence extends JavaPlugin {
Plugin p = getServer().getPluginManager().getPlugin("Essentials");
if (p != null) {
economy = new EssentialsEcoAdapter((Essentials) p);
Logger.getLogger("Minecraft").log(Level.INFO, "[Residence] 成功关联Essentials Economy!");
this.getLogger().info("成功关联Essentials Economy!");
} else {
Logger.getLogger("Minecraft").log(Level.INFO, "[Residence] Essentials Economy 未找到!");
this.getLogger().info("Essentials Economy 未找到!");
}
}
public void loadLang(File langFile) throws FileNotFoundException, IOException, InvalidConfigurationException {
FileConfig langconfig = new FileConfig();
langconfig.load(langFile);
helppages = HelpEntry.parseHelp(langconfig, "CommandHelp");
HelpEntry.setLinesPerPage(langconfig.getInt("HelpLinesPerPage", 7));
InformationPager.setLinesPerPage(langconfig.getInt("HelpLinesPerPage", 7));
language = Language.parseText(langconfig, "Language");
}
private void loadVaultEconomy() {
Plugin p = getServer().getPluginManager().getPlugin("Vault");
if (p != null) {
ResidenceVaultAdapter vault = new ResidenceVaultAdapter(getServer());
if (vault.economyOK()) {
Logger.getLogger("Minecraft").log(Level.INFO,
"[Residence] 发现 Vault 使用经济系统: " + vault.getEconomyName());
this.getLogger().info("发现 Vault 使用经济系统: " + vault.getEconomyName());
economy = vault;
} else {
Logger.getLogger("Minecraft").log(Level.INFO,
"[Residence] 发现 Vault, 但是 Vault 未找到经济系统...");
this.getLogger().info("发现 Vault, 但是 Vault 未找到经济系统...");
}
} else {
Logger.getLogger("Minecraft").log(Level.INFO, "[Residence] Vault 未找到!");
this.getLogger().info("Vault 未找到!");
}
}
@ -385,7 +390,8 @@ public class Residence extends JavaPlugin {
// System.out.print("[Residence] Loaded...");
return true;
} catch (Exception ex) {
Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null, ex);
this.getLogger().warning("领地数据载入时发生错误,请报告一下内容给作者: ");
this.getLogger().warning("错误: " + ex);
throw ex;
}
}
@ -405,9 +411,9 @@ public class Residence extends JavaPlugin {
saveYml();
ZipLibrary.backup();
} catch (Exception ex) {
Logger.getLogger("Minecraft").log(Level.SEVERE, "[Residence] 插件数据保存失败", ex);
this.getLogger().warning("领地数据保存错误,可能造成部分领地丢失,请尝试恢复备份文件!");
this.getLogger().warning("错误: " + ex);
}
Logger.getLogger("Minecraft").log(Level.INFO, "[Residence] Disabled!");
}
}
@ -439,7 +445,7 @@ public class Residence extends JavaPlugin {
Plugin plugin = server.getPluginManager().getPlugin(multiworld);
if (plugin != null) {
if (!plugin.isEnabled()) {
this.getLogger().warning(" - 加载多世界插件: " + multiworld);
this.getLogger().info(" - 加载多世界插件: " + multiworld);
server.getPluginManager().enablePlugin(plugin);
}
}
@ -464,24 +470,14 @@ public class Residence extends JavaPlugin {
+ ".yml");
try {
if (langFile.isFile()) {
FileConfig langconfig = new FileConfig();
langconfig.load(langFile);
helppages = HelpEntry.parseHelp(langconfig, "CommandHelp");
HelpEntry.setLinesPerPage(langconfig.getInt("HelpLinesPerPage", 7));
InformationPager.setLinesPerPage(langconfig.getInt("HelpLinesPerPage", 7));
language = Language.parseText(langconfig, "Language");
loadLang(langFile);
} else {
this.getLogger().warning("语言文件不存在...");
}
} catch (Exception ex) {
this.getLogger().warning("语言文件载入失败: " + cmanager.getLanguage() + ".yml 写入默认语言文件");
this.writeDefaultLanguageFile(cmanager.getLanguage());
FileConfig langconfig = new FileConfig();
langconfig.load(langFile);
helppages = HelpEntry.parseHelp(langconfig, "CommandHelp");
HelpEntry.setLinesPerPage(langconfig.getInt("HelpLinesPerPage", 7));
InformationPager.setLinesPerPage(langconfig.getInt("HelpLinesPerPage", 7));
language = Language.parseText(langconfig, "Language");
loadLang(langFile);
}
economy = null;
if (this.getConfig().getBoolean("Global.EnableEconomy", false)) {
@ -507,8 +503,8 @@ public class Residence extends JavaPlugin {
try {
this.loadYml();
} catch (Exception e) {
this.getLogger().log(Level.SEVERE, "不能载入保存的文件", e);
throw e;
this.getLogger().warning("领地数据载入错误,可能造成插件无法启动,请尝试恢复备份文件!");
this.getLogger().warning("错误: " + e);
}
if (rmanager == null) {
rmanager = new ResidenceManager();
@ -529,7 +525,7 @@ public class Residence extends JavaPlugin {
Plugin p = server.getPluginManager().getPlugin("WorldEdit");
if (p != null) {
smanager = new WorldEditSelectionManager(server);
Logger.getLogger("Minecraft").log(Level.INFO, "[Residence] 发现 WorldEdit");
this.getLogger().info("发现 WorldEdit");
} else {
smanager = new SelectionManager(server);
this.getLogger().warning("WorldEdit 未找到!");
@ -578,14 +574,13 @@ public class Residence extends JavaPlugin {
turnResAdminOn(player);
}
}
Logger.getLogger("Minecraft").log(Level.INFO,
"[Residence] 载入完成! 版本: " + this.getDescription().getVersion() + " 重制 by 喵♂呜");
this.getLogger().info("载入完成! 版本: " + this.getDescription().getVersion() + " 重制 by 喵♂呜");
initsuccess = true;
} catch (Exception ex) {
initsuccess = false;
getServer().getPluginManager().disablePlugin(this);
this.getLogger().warning(" - 初始化失败! 卸载插件! 错误:");
Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null, ex);
this.getLogger().warning(" - 初始化失败! 卸载插件! 请报告一下错误给作者,谢谢!");
this.getLogger().warning("错误: " + ex);
}
}
@ -709,14 +704,14 @@ public class Residence extends JavaPlugin {
tmpFile.renameTo(ymlSaveLoc);
if (cmanager.showIntervalMessages()) {
System.out.println("[Residence] - 保存插件数据...");
this.getLogger().info(" - 保存插件数据...");
}
}
private void writeDefaultConfigFromJar() {
if (this.writeDefaultFileFromJar(new File(this.getDataFolder(), "config.yml"),
"config.yml", true)) {
System.out.println("[Residence] 保存默认配置文件...");
this.getLogger().info("保存默认配置文件...");
}
}
@ -757,7 +752,7 @@ public class Residence extends JavaPlugin {
}
return false;
} catch (Exception ex) {
System.out.println("[Residence] 文件写入失败: " + writeName);
this.getLogger().warning("文件写入失败: " + writeName);
return false;
}
}
@ -766,7 +761,7 @@ public class Residence extends JavaPlugin {
File outFile = new File(new File(this.getDataFolder(), "Language"), lang + ".yml");
outFile.getParentFile().mkdirs();
if (this.writeDefaultFileFromJar(outFile, "languagefiles/" + lang + ".yml", true)) {
System.out.println("[Residence] 保存默认 " + lang + " 语言文件...");
this.getLogger().info("保存默认 " + lang + " 语言文件...");
}
}
}