From 1ebbc6f091b3eb9db41e3c4d7f43382faf9e1d69 Mon Sep 17 00:00:00 2001 From: j502647092 Date: Thu, 28 May 2015 20:58:49 +0800 Subject: [PATCH] rebuild priject... Signed-off-by: j502647092 --- src/com/me/tft_02/soulbound/Soulbound.java | 212 ++++++++++----------- 1 file changed, 106 insertions(+), 106 deletions(-) diff --git a/src/com/me/tft_02/soulbound/Soulbound.java b/src/com/me/tft_02/soulbound/Soulbound.java index 845475e..3c6b9bc 100644 --- a/src/com/me/tft_02/soulbound/Soulbound.java +++ b/src/com/me/tft_02/soulbound/Soulbound.java @@ -26,117 +26,52 @@ import com.me.tft_02.soulbound.listeners.PlayerListener; import com.me.tft_02.soulbound.util.LogFilter; public class Soulbound extends JavaPlugin { - /* File Paths */ - private static String mainDirectory; + /* File Paths */ + private static String mainDirectory; - public static Soulbound p; + public static Soulbound p; - // Jar Stuff - public static File soulbound; + // Jar Stuff + public static File soulbound; - // Checks for hooking into other plugins - public static boolean epicBossRecodedEnabled = false; - public static boolean loreLocksEnabled = false; + // Checks for hooking into other plugins + public static boolean epicBossRecodedEnabled = false; + public static boolean loreLocksEnabled = false; - // Update Check - private boolean updateAvailable; - - public File msgfile; - public FileConfiguration msgConfig; - - 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); - } + public static String getMainDirectory() { + return mainDirectory; } - - - /** - * Run things on enable. - */ - @Override - public void onEnable() { - p = this; - getLogger().setFilter(new LogFilter(this)); - setupFilePaths(); + // Update Check + private boolean updateAvailable; + public File msgfile; - loadConfigFiles(); + public FileConfiguration msgConfig; - setupEpicBossRecoded(); - registerEvents(); + public void debug(String message) { + getLogger().info("[Debug] " + message); + } - getCommand("soulbound").setExecutor(new SoulboundCommand()); - getCommand("bind").setExecutor(new BindCommand()); - getCommand("bindonpickup").setExecutor(new BindOnPickupCommand()); - getCommand("bindonuse").setExecutor(new BindOnUseCommand()); - getCommand("bindonequip").setExecutor(new BindOnEquipCommand()); - getCommand("unbind").setExecutor(new UnbindCommand()); - } + public String getlang(String type) { + return this.getmessage("Message." + type); + } - private void registerEvents() { - PluginManager pm = getServer().getPluginManager(); - pm.registerEvents(new PlayerListener(), this); - pm.registerEvents(new InventoryListener(), this); - pm.registerEvents(new EntityListener(), this); - pm.registerEvents(new BlockListener(), this); - } + public String getmessage(String path) { + String message = this.msgConfig.getString(path).replaceAll("&", "§"); + return message; + } - private void setupEpicBossRecoded() { - if (getServer().getPluginManager().isPluginEnabled("EpicBossRecoded")) { - epicBossRecodedEnabled = true; - debug("EpicBossRecoded found!"); - getServer().getPluginManager().registerEvents(new EpicBossRecodedListener(), this); - } - } + public boolean isUpdateAvailable() { + return updateAvailable; + } - /** - * 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 { + } else return YamlConfiguration.loadConfiguration(cfgfile); - } } public void LoadConfig(FileConfiguration cfg, File cfgfile) @@ -150,20 +85,64 @@ public class Soulbound extends JavaPlugin { } } - public void Savecfg(FileConfiguration cfg, File cfgfile) { + private void loadConfigFiles() { + Config.getInstance(); + ItemsConfig.getInstance(); + } + + /** + * Run things on disable. + */ + @Override + public void onDisable() {} + + /** + * Run things on enable. + */ + @Override + public void onEnable() { + p = this; + getLogger().setFilter(new LogFilter(this)); + + setupFilePaths(); + + loadConfigFiles(); + + setupEpicBossRecoded(); + + registerEvents(); + + getCommand("soulbound").setExecutor(new SoulboundCommand()); + getCommand("bind").setExecutor(new BindCommand()); + getCommand("bindonpickup").setExecutor(new BindOnPickupCommand()); + getCommand("bindonuse").setExecutor(new BindOnUseCommand()); + getCommand("bindonequip").setExecutor(new BindOnEquipCommand()); + getCommand("unbind").setExecutor(new UnbindCommand()); + } + + @Override + public void onLoad() { + msgfile = new File(this.getDataFolder(), "message.yml"); + msgConfig = YamlConfiguration.loadConfiguration(msgfile); try { - // cfg.saveToString(); - cfg.save(cfgfile); + LoadConfig (msgConfig ,msgfile); + } catch (FileNotFoundException e) { + this.saveResource("message.yml", true); } catch (IOException e) { - getLogger().info("配置文件" + cfgfile.getName() + "已保存!"); + this.getLogger().info("语言文件读取错误..."); + } catch (InvalidConfigurationException e) { + this.saveResource("message.yml", true); } } - - public String getmessage(String path) { - String message = this.msgConfig.getString(path).replaceAll("&", "§"); - return message; + + private void registerEvents() { + PluginManager pm = getServer().getPluginManager(); + pm.registerEvents(new PlayerListener(), this); + pm.registerEvents(new InventoryListener(), this); + pm.registerEvents(new EntityListener(), this); + pm.registerEvents(new BlockListener(), this); } - + public void reloadmessage(){ try { LoadConfig (msgConfig ,msgfile); @@ -175,9 +154,30 @@ public class Soulbound extends JavaPlugin { this.saveResource("message.yml", true); } } - - public String getlang(String type) { - return this.getmessage("Message." + type); + + public void Savecfg(FileConfiguration cfg, File cfgfile) { + 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; + } + }