Info
Content

SpigotAPI

Set Server Data:

Tip: Use this, to set the Sign Data. More Information: Change text on Server Signs

Server self = SpigotApi.getSelfServer();
self.getServerData()
    .setPlayers(Bukkit.getOnlinePlayers().size())
    .setGameState(SpigotApi.getGamestate(this.gamestate))
    .setMaxplayers(this.maxPlayers)
   .setMotd(motd);

SpigotApi.updateSelfServerData();

Send custom data to the cloud:

If you want to send data to the cloud, you can use this code. For the cloud to do something, you need to develop a plugin for the cloud that has a registered listener.

PacketDataConstructor packetDataConstructor = new PacketDataConstructor();
packetDataConstructor.add("key", "value");

OutgoingDataPacket outgoingDataPacket = new OutgoingDataPacket(packetDataConstructor);
SpigotApi.sendMessageToCloud(outgoingDataPacket);

Events:

All these events are registered as normal events (like the PlayerJoinEvent) in your spigot plugin.

To receive messages from your cloud plugin, you need to register a listener with the following event:

CloudMessageReciveEvent

To see when a server's data has changed, you can use this event:

ServerDataChangeEvent

To see when a server is offline, you can use this event:

ServerRemoveEvent

JavaDocs:

Here you find the JavaDocs: SpigotAPI JavaDocs

No Comments
Back to top