use of xyz.derkades.serverselectorx.placeholders.PlaceholdersDisabled in project ServerSelectorX by ServerSelectorX.
the class Main method onEnable.
@Override
public void onEnable() {
plugin = this;
configurationManager = new ConfigurationManager();
configurationManager.reloadAll();
// Register listeners
Bukkit.getPluginManager().registerEvents(new SelectorOpenListener(), this);
Bukkit.getPluginManager().registerEvents(new OnJoinListener(), this);
Bukkit.getPluginManager().registerEvents(new ItemMoveDropCancelListener(), this);
List<String> offHandVersions = Arrays.asList("1.9", "1.10", "1.11", "1.12");
for (String version : offHandVersions) {
if (Bukkit.getBukkitVersion().contains(version)) {
Bukkit.getPluginManager().registerEvents(new OffHandMoveCancel(), this);
}
}
// Register messaging channels
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
Bukkit.getScheduler().runTaskAsynchronously(this, () -> PingServersBackground.startPinging());
// Register command
getCommand("serverselectorx").setExecutor(new ReloadCommand());
// Start bStats
Stats.initialize();
// Check if config is up to date
int version = getConfig().getInt("version");
if (version != CONFIG_VERSION) {
Logger logger = super.getLogger();
logger.log(Level.SEVERE, "************** IMPORTANT **************");
logger.log(Level.SEVERE, "You updated the plugin without deleting the config.");
logger.log(Level.SEVERE, "Please rename config.yml to something else and restart your server.");
logger.log(Level.SEVERE, "If you don't want to redo your config, see resource updates on spigotmc.org for instructions.");
logger.log(Level.SEVERE, "***************************************");
getServer().getPluginManager().disablePlugin(this);
return;
}
// Register custom selector commands
registerCommands();
// Check if PlaceHolderAPI is installed
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
Main.PLACEHOLDER_API = new PlaceholdersEnabled();
getLogger().log(Level.INFO, "PlaceholderAPI is found. Placeholders will work!");
} else {
Main.PLACEHOLDER_API = new PlaceholdersDisabled();
getLogger().log(Level.INFO, "PlaceholderAPI is not installed. The plugin will still work.");
}
// Check for updates asynchronously
getServer().getScheduler().runTaskAsynchronously(this, () -> {
checkForUpdates();
});
}
Aggregations