1
0
mirror of https://e.coding.net/circlecloud/Soulbound.git synced 2024-11-22 01:49:09 +00:00

rebuild priject...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-05-28 20:58:49 +08:00
parent 6e8277c690
commit 1ebbc6f091

View File

@ -38,26 +38,63 @@ public class Soulbound extends JavaPlugin {
public static boolean epicBossRecodedEnabled = false; public static boolean epicBossRecodedEnabled = false;
public static boolean loreLocksEnabled = false; public static boolean loreLocksEnabled = false;
public static String getMainDirectory() {
return mainDirectory;
}
// Update Check // Update Check
private boolean updateAvailable; private boolean updateAvailable;
public File msgfile; public File msgfile;
public FileConfiguration msgConfig; public FileConfiguration msgConfig;
public void onLoad() {
msgfile = new File(this.getDataFolder(), "message.yml"); public void debug(String message) {
msgConfig = YamlConfiguration.loadConfiguration(msgfile); getLogger().info("[Debug] " + message);
try { }
LoadConfig (msgConfig ,msgfile);
} catch (FileNotFoundException e) { public String getlang(String type) {
this.saveResource("message.yml", true); return this.getmessage("Message." + type);
} catch (IOException e) { }
this.getLogger().info("语言文件读取错误...");
} catch (InvalidConfigurationException e) { public String getmessage(String path) {
this.saveResource("message.yml", true); String message = this.msgConfig.getString(path).replaceAll("&", "§");
return message;
}
public boolean isUpdateAvailable() {
return updateAvailable;
}
public FileConfiguration Loadcfg(File cfgfile) {
if (!cfgfile.exists()) {
saveResource(cfgfile.getName(), false);
return YamlConfiguration.loadConfiguration(cfgfile);
} else
return YamlConfiguration.loadConfiguration(cfgfile);
}
public void LoadConfig(FileConfiguration cfg, File cfgfile)
throws FileNotFoundException, IOException,
InvalidConfigurationException {
if (!cfgfile.exists()) {
saveResource(cfgfile.getName(), false);
cfg.load(cfgfile);
} else {
cfg.load(cfgfile);
} }
} }
private void loadConfigFiles() {
Config.getInstance();
ItemsConfig.getInstance();
}
/**
* Run things on disable.
*/
@Override
public void onDisable() {}
/** /**
* Run things on enable. * Run things on enable.
@ -83,6 +120,21 @@ public class Soulbound extends JavaPlugin {
getCommand("unbind").setExecutor(new UnbindCommand()); getCommand("unbind").setExecutor(new UnbindCommand());
} }
@Override
public void onLoad() {
msgfile = new File(this.getDataFolder(), "message.yml");
msgConfig = YamlConfiguration.loadConfiguration(msgfile);
try {
LoadConfig (msgConfig ,msgfile);
} catch (FileNotFoundException e) {
this.saveResource("message.yml", true);
} catch (IOException e) {
this.getLogger().info("语言文件读取错误...");
} catch (InvalidConfigurationException e) {
this.saveResource("message.yml", true);
}
}
private void registerEvents() { private void registerEvents() {
PluginManager pm = getServer().getPluginManager(); PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new PlayerListener(), this); pm.registerEvents(new PlayerListener(), this);
@ -91,79 +143,6 @@ public class Soulbound extends JavaPlugin {
pm.registerEvents(new BlockListener(), this); pm.registerEvents(new BlockListener(), this);
} }
private void setupEpicBossRecoded() {
if (getServer().getPluginManager().isPluginEnabled("EpicBossRecoded")) {
epicBossRecodedEnabled = true;
debug("EpicBossRecoded found!");
getServer().getPluginManager().registerEvents(new EpicBossRecodedListener(), this);
}
}
/**
* Run things on disable.
*/
@Override
public void onDisable() {}
public static String getMainDirectory() {
return mainDirectory;
}
public boolean isUpdateAvailable() {
return updateAvailable;
}
public void debug(String message) {
getLogger().info("[Debug] " + message);
}
/**
* Setup the various storage file paths
*/
private void setupFilePaths() {
soulbound = getFile();
mainDirectory = getDataFolder().getPath() + File.separator;
}
private void loadConfigFiles() {
Config.getInstance();
ItemsConfig.getInstance();
}
public FileConfiguration Loadcfg(File cfgfile) {
if (!cfgfile.exists()) {
saveResource(cfgfile.getName(), false);
return YamlConfiguration.loadConfiguration(cfgfile);
} else {
return YamlConfiguration.loadConfiguration(cfgfile);
}
}
public void LoadConfig(FileConfiguration cfg, File cfgfile)
throws FileNotFoundException, IOException,
InvalidConfigurationException {
if (!cfgfile.exists()) {
saveResource(cfgfile.getName(), false);
cfg.load(cfgfile);
} else {
cfg.load(cfgfile);
}
}
public void Savecfg(FileConfiguration cfg, File cfgfile) {
try {
// cfg.saveToString();
cfg.save(cfgfile);
} catch (IOException e) {
getLogger().info("配置文件" + cfgfile.getName() + "已保存!");
}
}
public String getmessage(String path) {
String message = this.msgConfig.getString(path).replaceAll("&", "§");
return message;
}
public void reloadmessage(){ public void reloadmessage(){
try { try {
LoadConfig (msgConfig ,msgfile); LoadConfig (msgConfig ,msgfile);
@ -176,8 +155,29 @@ public class Soulbound extends JavaPlugin {
} }
} }
public String getlang(String type) { public void Savecfg(FileConfiguration cfg, File cfgfile) {
return this.getmessage("Message." + type); try {
// cfg.saveToString();
cfg.save(cfgfile);
} catch (IOException e) {
getLogger().info("配置文件" + cfgfile.getName() + "已保存!");
}
}
private void setupEpicBossRecoded() {
if (getServer().getPluginManager().isPluginEnabled("EpicBossRecoded")) {
epicBossRecodedEnabled = true;
debug("EpicBossRecoded found!");
getServer().getPluginManager().registerEvents(new EpicBossRecodedListener(), this);
}
}
/**
* Setup the various storage file paths
*/
private void setupFilePaths() {
soulbound = getFile();
mainDirectory = getDataFolder().getPath() + File.separator;
} }
} }