SkinsRestorer API
To make things easy, we created an example plugin that connects to the coding API that can be found here: [link (opens in a new tab)]
When using BungeeCord/Velocity?
If you are using BungeeCord/Velocity, you must have a plugin that calls to the API on BungeeCord/Velocity. You would need to use in/out put channels to send this information across both of your custom plugins.
Getting issues?
- Make sure to import the
net.skinsrestorer.api.SkinsRestorerAPI
&net.skinsrestorer.api.PlayerWrapper
in your code (see example code) - Make sure to get the API using
skinsRestorerAPI = SkinsRestorerAPI.getApi()
and define by addingprivate SkinsRestorerAPI skinsRestorerAPI;
at the start of your class. - If you don't know that the issue is causing, include a try catch, so you can print our exceptions using e.print... etc
Using Plugin Message Channel
If you are using BungeeCord/Velocity, and you want your plugin to work from spigot. You could use Plugin Message Channel (opens in a new tab) to send the commands to bungee cord.
Messages list
sr:message is only to "forward" commands from spigot to bungee. This includes cooldown, permissions checks and always send feedback to player. If you want to run it as a console (without checks), you will have to wait for sr:adminchannel
To proxy:
Message (sr:messagechannel +) |
---|
setSkin p skin/url |
clearSkin p |
getSkins page |
To bukkit:
Message |
---|
sr:messagechannel OPENGUI p |
sr:skinchange SkinUpdate name value signature |
Sending a message
First, you need to register the channel (on startup)
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "sr:messagechannel");
Example of how we send /skin set <player> <skin>
over a plugin message channel:
try {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(bytes);
out.writeUTF("setSkin");
out.writeUTF(p.getName());
out.writeUTF(skin);
p.sendPluginMessage(this, "sr:messagechannel", bytes.toByteArray());
} catch (IOException e) {
e.printStackTrace();
}