-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Jacob edited this page Dec 15, 2021
·
10 revisions
A spigot-bungee handshake.
This plugin currently exists to allows other plugins to pass-through BungeeCord commands.
If you are trying to use ItemJoin for example, bungee: friends
on your custom item commands, you will need this plugin installed onto your BungeeCord server.
1.) Drag and drop this plugin (CloudSync) into your BungeeCord plugins folder.
2.) Drag and drop the supporting plugin into your Spigot/Bukkit plugins folder.
private final String PLUGIN_CHANNEL = "plugin:cloudsync";
private boolean detectFailure = false;
/**
* Initializes the BungeeCord Listener.
*
*/
public BungeeAPI() {
final Messenger messenger = YourPlugin.getInstance().getServer().getMessenger();
if (!messenger.isOutgoingChannelRegistered(YourPlugin.getInstance(), this.PLUGIN_CHANNEL)) {
messenger.registerOutgoingPluginChannel(YourPlugin.getInstance(), this.PLUGIN_CHANNEL);
}
if (!messenger.isIncomingChannelRegistered(YourPlugin.getInstance(), this.PLUGIN_CHANNEL)) {
messenger.registerIncomingPluginChannel(YourPlugin.getInstance(), this.PLUGIN_CHANNEL, this);
}
}
/**
* Executes the BungeeCord Command as the Player instance.
*
* @param player - The Player executing the Bungee Command.
* @param command - The Bungee Command the Player is executing.
*/
public void ExecuteCommand(final Player player, final String command) {
if (StringUtils.containsIgnoreCase(player.getListeningPluginChannels().toString(), "plugin:cloudsync")) {
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
try {
out.writeUTF(player.getName());
out.writeUTF(command);
} catch (Exception e) { ServerUtils.sendDebugTrace(e); }
player.sendPluginMessage(ItemJoin.getInstance(), this.PLUGIN_CHANNEL, out.toByteArray());
} else {
if (!this.detectFailure) {
Bukkit.getServer().getLogger().severe("Failed to execute the Bungee command /" + command + " because CloudSync was not detected on your BungeeCord server.");
this.detectFailure = true;
}
}
}
If you have any ideas or requests that you would like to see in this plugins future please submit a feature request.