mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2024-10-31 22:38:48 +00:00
fix language file load...
This commit is contained in:
parent
bbc3a7ff9c
commit
984b8608a0
@ -28,7 +28,6 @@ import org.bukkit.World;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
@ -36,6 +35,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.bekvon.bukkit.residence.chat.ChatManager;
|
||||
import com.bekvon.bukkit.residence.config.Config;
|
||||
import com.bekvon.bukkit.residence.config.FileConfig;
|
||||
import com.bekvon.bukkit.residence.economy.EconomyInterface;
|
||||
import com.bekvon.bukkit.residence.economy.EssentialsEcoAdapter;
|
||||
import com.bekvon.bukkit.residence.economy.TransactionManager;
|
||||
@ -69,6 +69,7 @@ import com.residence.zip.ZipLibrary;
|
||||
*/
|
||||
public class Residence extends JavaPlugin {
|
||||
|
||||
public static String bukkitver;
|
||||
protected static ResidenceManager rmanager;
|
||||
protected static SelectionManager smanager;
|
||||
protected static PermissionManager gmanager;
|
||||
@ -97,9 +98,7 @@ public class Residence extends JavaPlugin {
|
||||
protected static boolean initsuccess = false;
|
||||
protected Map<String, String> deleteConfirm;
|
||||
protected static List<String> resadminToggle;
|
||||
private final static String[] validLanguages = { "English", "German",
|
||||
"French", "Hungarian", "Spanish", "Chinese", "Czech", "Brazilian",
|
||||
"Polish" };
|
||||
private final static String[] validLanguages = { "English", "Chinese" };
|
||||
private Runnable doHeals = new Runnable() {
|
||||
public void run() {
|
||||
plistener.doHeals();
|
||||
@ -129,7 +128,7 @@ public class Residence extends JavaPlugin {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger("Minecraft").log(Level.SEVERE,
|
||||
"[Residence] SEVERE SAVE ERROR", ex);
|
||||
"[Residence] 插件数据 保存 错误", ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -146,7 +145,7 @@ public class Residence extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public FileConfiguration getConfig() {
|
||||
if(Config.getInstance()==null){
|
||||
if (Config.getInstance() == null) {
|
||||
Config.load(this);
|
||||
}
|
||||
return Config.getInstance();
|
||||
@ -188,6 +187,7 @@ public class Residence extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
try {
|
||||
bukkitver = this.getServer().getBukkitVersion().substring(0, 5);
|
||||
initsuccess = false;
|
||||
deleteConfirm = new HashMap<String, String>();
|
||||
resadminToggle = new ArrayList<String>();
|
||||
@ -203,8 +203,7 @@ public class Residence extends JavaPlugin {
|
||||
if (this.getConfig().getInt("ResidenceVersion", 0) == 0) {
|
||||
this.writeDefaultConfigFromJar();
|
||||
this.getConfig().load("config.yml");
|
||||
System.out
|
||||
.println("[Residence] Config Invalid, wrote default...");
|
||||
System.out.println("[Residence] 配置文件不存在,写入默认配置文件.");
|
||||
}
|
||||
cmanager = new ConfigManager(this.getConfig());
|
||||
String multiworld = cmanager.getMultiworldPlugin();
|
||||
@ -212,8 +211,7 @@ public class Residence extends JavaPlugin {
|
||||
Plugin plugin = server.getPluginManager().getPlugin(multiworld);
|
||||
if (plugin != null) {
|
||||
if (!plugin.isEnabled()) {
|
||||
System.out
|
||||
.println("[Residence] - Enabling multiworld plugin: "
|
||||
System.out.println("[Residence] - 加载多世界插件: "
|
||||
+ multiworld);
|
||||
server.getPluginManager().enablePlugin(plugin);
|
||||
}
|
||||
@ -231,8 +229,7 @@ public class Residence extends JavaPlugin {
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.out
|
||||
.println("[Residence] 语言文件升级失败: "
|
||||
+ lang + ".yml");
|
||||
.println("[Residence] 语言文件升级失败: " + lang + ".yml");
|
||||
helppages = new HelpEntry("");
|
||||
language = new Language();
|
||||
}
|
||||
@ -241,7 +238,7 @@ public class Residence extends JavaPlugin {
|
||||
File langFile = new File(new File(dataFolder, "Language"),
|
||||
cmanager.getLanguage() + ".yml");
|
||||
if (langFile.isFile()) {
|
||||
FileConfiguration langconfig = new YamlConfiguration();
|
||||
FileConfig langconfig = new FileConfig();
|
||||
langconfig.load(langFile);
|
||||
helppages = HelpEntry.parseHelp(langconfig, "CommandHelp");
|
||||
HelpEntry.setLinesPerPage(langconfig.getInt(
|
||||
@ -250,8 +247,7 @@ public class Residence extends JavaPlugin {
|
||||
"HelpLinesPerPage", 7));
|
||||
language = Language.parseText(langconfig, "Language");
|
||||
} else {
|
||||
System.out
|
||||
.println("[Residence] 语言文件不存在...");
|
||||
System.out.println("[Residence] 语言文件不存在...");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
System.out.println("[Residence] 语言文件载入失败: "
|
||||
@ -264,15 +260,13 @@ public class Residence extends JavaPlugin {
|
||||
}
|
||||
economy = null;
|
||||
if (this.getConfig().getBoolean("Global.EnableEconomy", false)) {
|
||||
System.out
|
||||
.println("[Residence] 扫描经济系统...");
|
||||
System.out.println("[Residence] 扫描经济系统...");
|
||||
if (gmanager.getPermissionsPlugin() instanceof ResidenceVaultAdapter) {
|
||||
ResidenceVaultAdapter vault = (ResidenceVaultAdapter) gmanager
|
||||
.getPermissionsPlugin();
|
||||
if (vault.economyOK()) {
|
||||
economy = vault;
|
||||
System.out
|
||||
.println("[Residence] 发现 Vault 使用经济系统: "
|
||||
System.out.println("[Residence] 发现 Vault 使用经济系统: "
|
||||
+ vault.getEconomyName());
|
||||
}
|
||||
}
|
||||
@ -283,15 +277,13 @@ public class Residence extends JavaPlugin {
|
||||
this.loadEssentialsEconomy();
|
||||
}
|
||||
if (economy == null) {
|
||||
System.out
|
||||
.println("[Residence] 未找到经济系统...");
|
||||
System.out.println("[Residence] 未找到经济系统...");
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.loadYml();
|
||||
} catch (Exception e) {
|
||||
this.getLogger().log(Level.SEVERE, "不能载入保存的文件",
|
||||
e);
|
||||
this.getLogger().log(Level.SEVERE, "不能载入保存的文件", e);
|
||||
throw e;
|
||||
}
|
||||
if (rmanager == null) {
|
||||
@ -382,8 +374,7 @@ public class Residence extends JavaPlugin {
|
||||
} catch (Exception ex) {
|
||||
initsuccess = false;
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
System.out
|
||||
.println("[Residence] - 初始化失败! 卸载插件! 错误:");
|
||||
System.out.println("[Residence] - 初始化失败! 卸载插件! 错误:");
|
||||
Logger.getLogger(Residence.class.getName()).log(Level.SEVERE, null,
|
||||
ex);
|
||||
}
|
||||
@ -526,9 +517,8 @@ public class Residence extends JavaPlugin {
|
||||
+ vault.getEconomyName());
|
||||
economy = vault;
|
||||
} else {
|
||||
Logger.getLogger("Minecraft")
|
||||
.log(Level.INFO,
|
||||
"[Residence] 发现 Vault, 但是 Vault 无法使用经济系统...");
|
||||
Logger.getLogger("Minecraft").log(Level.INFO,
|
||||
"[Residence] 发现 Vault, 但是 Vault 未找到经济系统...");
|
||||
}
|
||||
} else {
|
||||
Logger.getLogger("Minecraft").log(Level.INFO,
|
||||
@ -736,8 +726,7 @@ public class Residence extends JavaPlugin {
|
||||
outFile.getParentFile().mkdirs();
|
||||
if (this.writeDefaultFileFromJar(outFile, "languagefiles/" + lang
|
||||
+ ".yml", true)) {
|
||||
System.out.println("[Residence] 保存默认 " + lang
|
||||
+ " 语言文件...");
|
||||
System.out.println("[Residence] 保存默认 " + lang + " 语言文件...");
|
||||
}
|
||||
}
|
||||
|
||||
@ -748,14 +737,14 @@ public class Residence extends JavaPlugin {
|
||||
File checkFile = new File(new File(this.getDataFolder(), "Language"),
|
||||
"temp-" + lang + ".yml");
|
||||
if (outFile.isFile()) {
|
||||
FileConfiguration testconfig = new YamlConfiguration();
|
||||
FileConfig testconfig = new FileConfig();
|
||||
testconfig.load(outFile);
|
||||
int oldversion = testconfig.getInt("FieldsVersion", 0);
|
||||
if (!this.writeDefaultFileFromJar(checkFile, "languagefiles/"
|
||||
+ lang + ".yml", false)) {
|
||||
return false;
|
||||
}
|
||||
FileConfiguration testconfig2 = new YamlConfiguration();
|
||||
FileConfig testconfig2 = new FileConfig();
|
||||
testconfig2.load(checkFile);
|
||||
int newversion = testconfig2.getInt("FieldsVersion", oldversion);
|
||||
if (checkFile.isFile()) {
|
||||
@ -808,8 +797,7 @@ public class Residence extends JavaPlugin {
|
||||
}
|
||||
return false;
|
||||
} catch (Exception ex) {
|
||||
System.out
|
||||
.println("[Residence] 文件写入失败: " + writeName);
|
||||
System.out.println("[Residence] 文件写入失败: " + writeName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user