use of com.toonystank.armorswap.utils.ConfigData in project ArmorSwap by taggernation.
the class ArmorSwap method onEnable.
@Override
public void onEnable() {
try {
configData = new ConfigData(this);
configData.updateConfig(this.getDescription().getVersion(), ConfigDataType.VERSION.getName());
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
new UpdateChecker(this, 97332).getVersion(version -> {
if (this.getDescription().getVersion().equals(version)) {
getLogger().info("There is not a new update available.");
} else {
getLogger().info("There is a new update available." + "\n" + ChatColor.RED + "https://www.spigotmc.org/resources/armorswap-swap-items-by-right-clicking.97332/");
}
});
// bStats metrics
// https://bstats.org/what-is-my-plugin-id
Metrics metrics = new Metrics(this, 14140);
setPlugin(this);
// Events
getServer().getPluginManager().registerEvents(new OnJoin(), this);
try {
getServer().getPluginManager().registerEvents(new ClickEvent(configData, this), this);
} catch (IOException e) {
e.printStackTrace();
}
// Checks if server is running on Paper or not
boolean isOnPaper = false;
try {
Class.forName("com.destroystokyo.paper");
isOnPaper = true;
} catch (ClassNotFoundException ignored) {
}
// Initializing Command manager
if (isOnPaper) {
PaperCommandManager pcm = new PaperCommandManager(this);
pcm.registerCommand(new CommandManager(configData, this));
} else {
BukkitCommandManager bcm = new BukkitCommandManager(this);
bcm.registerCommand(new CommandManager(configData, this));
}
// Config
getLogger().info(ChatColor.AQUA + "ArmorSwap " + ChatColor.UNDERLINE + "Successfully loaded.");
}
Aggregations