use of com.github.games647.changeskin.bukkit.bungee.SkinUpdateListener in project ChangeSkin by games647.
the class ChangeSkinBukkit method onEnable.
@Override
public void onEnable() {
try {
bungeeCord = getServer().spigot().getConfig().getBoolean("settings.bungeecord");
} catch (Exception | NoSuchMethodError ex) {
logger.warn("Cannot check bungeecord support. You use a non-Spigot build");
}
registerCommands();
try {
core.load(!bungeeCord);
} catch (Exception ex) {
logger.error("Error initializing plugin. Disabling...", ex);
setEnabled(false);
return;
}
if (bungeeCord) {
logger.info("BungeeCord detected. Activating BungeeCord support");
logger.info("Make sure you installed the plugin on BungeeCord too");
// outgoing
Messenger messenger = getServer().getMessenger();
String permissionResultChannel = new NamespaceKey(getName(), PERMISSION_RESULT_CHANNEL).getCombinedName();
String forwardChannel = new NamespaceKey(getName(), FORWARD_COMMAND_CHANNEL).getCombinedName();
messenger.registerOutgoingPluginChannel(this, permissionResultChannel);
messenger.registerOutgoingPluginChannel(this, forwardChannel);
// incoming
String updateChannel = new NamespaceKey(getName(), UPDATE_SKIN_CHANNEL).getCombinedName();
String permissionChannel = new NamespaceKey(getName(), CHECK_PERM_CHANNEL).getCombinedName();
messenger.registerIncomingPluginChannel(this, updateChannel, new SkinUpdateListener(this));
messenger.registerIncomingPluginChannel(this, permissionChannel, new CheckPermissionListener(this));
} else {
getServer().getPluginManager().registerEvents(new LoginListener(this), this);
}
}
Aggregations