Skip to content

Use SkyBlock in your plugin

GiantQuartz edited this page Mar 27, 2020 · 1 revision

Use SkyBlock in your plugin

Adding SkyBlock to the dependency list

If your plugin always requires SkyBlock to work, the first step is to add it to the dependency list on your plugin manifest (plugin.yml):

depend:
  - SkyBlock

Importing SkyBlock into your plugin

There are many ways to do this, but the most common ones are these:

Using PocketMine-MP API (Recommended)

If your plugin is going to be published in Poggit or used by people that doesn't code, this is probably the method you should go with.

// $server must be an instance of PocketMine's Server class
// $skyblock could be null if the plugin isn't loaded!
$skyblock = $server->getPluginManager()->getPlugin("SkyBlock");

Using SkyBlock API

This is a less safe method to obtain SkyBlock's main class, as it will throw errors if the class is not loaded, but it comes in handy when you are certain that it will be.

$skyblock = SkyBlock::getInstance();