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:
parent
6e8277c690
commit
1ebbc6f091
@ -26,24 +26,101 @@ 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 static String getMainDirectory() {
|
||||
return mainDirectory;
|
||||
}
|
||||
|
||||
// Update Check
|
||||
private boolean updateAvailable;
|
||||
public File msgfile;
|
||||
|
||||
public FileConfiguration msgConfig;
|
||||
|
||||
|
||||
public void debug(String message) {
|
||||
getLogger().info("[Debug] " + message);
|
||||
}
|
||||
|
||||
public String getlang(String type) {
|
||||
return this.getmessage("Message." + type);
|
||||
}
|
||||
|
||||
public String getmessage(String path) {
|
||||
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.
|
||||
*/
|
||||
@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);
|
||||
@ -58,110 +135,12 @@ public class Soulbound extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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());
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
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(){
|
||||
@ -176,8 +155,29 @@ public class Soulbound extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user