Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

Developer Documentation

AGTHARN edited this page Dec 19, 2021 · 11 revisions

Developer Documentation

This page will guide you through the use of FlyPE's API. The purpose of this documentation is to only make it easier to look. Do not copy this documentation blindly and use only what you need!

NOTE: THE DOCUMENTATION IS BASED ON AN UNRELEASED/UNPUSHED VERSION OF FLYPE!

CURRENTLY UPDATED FOR: v5.2.0

Getting Started

Getting FlyPE Instance

Start by getting an instance of the plugin. Make sure that FlyPE has loaded in before using.

$flyPE = Server::getInstance()->getPluginManager()->getPlugin('FlyPE');

Getting FlyPE's Classes

Upon getting an instance of the plugin, you'll have access to all the classes in the plugin. They can be accessed through the class properties as shown below.

$flyPE = Server::getInstance()->getPluginManager()->getPlugin('FlyPE');

//$util = $flyPE->util;
//$config = $flyPE->config;
//$dataBase = $flyPE->dataBase;

//$economy = $flyPE->economy;
//$sessionManager = $flyPE->sessionManager;
//$integration = $flyPE->integration;
//$flight = $flyPE->flight;

//$soundList = $flyPE->soundList;
//$soundManager = $flyPE->soundManager;
//$particleList = $flyPE->particleList;
//$particleManager = $flyPE->particleManager;
//$effectList = $flyPE->effectList;
//$effectManager = $flyPE->effectManager;
//$capeList = $flyPE->capeList;
//$capeManager = $flyPE->capeManager;

//$flightForm = $flyPE->flightForm;
//$soundForm = $flyPE->soundForm;
//$particleForm = $flyPE->particleForm;
//$effectForm = $flyPE->effectForm;
//$capeForm = $flyPE->capeForm;

API Usage

Config

This class is used to manage configs.

/** @var pocketmine\utils\Config[] */
public array $configs;

/** Returns a config value in a file. Look at generateConfigs() for file name. */
public function getConfig(string $fileName, string $configName): mixed
/** Returns the default config value in the plugin. Used as a backup value for config values. */
public function getConfigDefault(string $fileName, string $configName): mixed
/** Generates all the configs in plugin data automatically. */
public function generateConfigs(): void
/** Checks the version of the config files and takes action. */
public function checkConfigs(): bool
/** Update the configs to the configs in the plugin. */
public function updateConfigs(array $configTypes): void
/** Updates the languages to the languages in the plugin. */
public function updateLanguageFiles(): void
/** Saves all resources/files in the plugin data folder. */
public function saveAllResources(): void
/** Reloads all the configs. */
public function reloadConfigs(): void

Database

This class is used to manage database providers.

public const SQLITE = 'sqlite';
public const MYSQL = 'mysql';
public const YAML = 'yaml';
public const JSON = 'json';

/** @var DataConnector */
public DataConnector $libasynql;

/** Initialize databases based on type. */
public function initDB(): void
/** Disable databases based on type. */
public function runDisable(): void
/** Returns the default keys and values of database. */
public function getDefaults(Player $player): array
/** Returns the type of database. */
public function getType(): string

Util

This class is used to keep code that cannot be classified into a specific class.

/** Schedules repeating tasks. */
public function prepareTasks(): void
/** Prepares cosmetics by excluding cosmetics based on the cosmetic config. */
public function prepareCosmetics(): void
/** Sends a translated message to a player. **(DEPRECATED)** */
public function sendTranslated(CommandSender $sender, string $id): void

Integration

This class is used to manage integration with other plugins.

/** Returns whether another flight plugin is detected and will make a warning. */
public function checkFlightPlugins(): bool
/** Returns the names of the flight plugins detected. */
public function getFlightPlugins(): array
/** Returns whether plugin integration is required. */
public function isAdjustmentRequired(Player $player): bool
/** Returns the [name, instance] of integration plugins detected. */
public function getIntegrationPlugins(): array

Flight

This class is used to manage flight for players/worlds.

/** Toggles flight for a player and adjusts based on parameters given. Returns successful or not. */
public function toggleFlight(Player $player, ?bool $toggleMode = null, ?int $flightTime = null, bool $ignoreWorld = false): bool
/** Returns whether flight is toggled for a player, including flight state check. */
public function isFlightToggled(Player $player, bool $strictCheck = false): bool
/** Returns whether gamemode is allowed. */
public function isGamemodeAllowed(Player $player): bool
/** Returns whether the world given is allowed. */
public function isWorldAllowed(World $world): bool

SoundList

This class is

/** */

SoundManager

This class is

/** */

ParticleList

This class is

/** */

ParticleManager

This class is

/** */

EffectList

This class is

/** */

EffectManager

This class is

/** */

CapeList

This class is

/** */

CapeManager

This class is

/** */

FlightForm

This class is

/** */

SoundForm

This class is

/** */

ParticleForm

This class is

/** */

EffectForm

This class is

/** */
Clone this wiki locally