Main
extends PluginBase
in package
Table of Contents
- $std : AwaitStd
- $config : Config|null
- $configFile : string
- $dataFolder : string
- $description : PluginDescription
- $file : string
- $instance : self
- $isEnabled : bool
- $loader : PluginLoader
- $logger : PluginLogger
- $resourceProvider : ResourceProvider
- $scheduler : TaskScheduler
- $server : Server
- __construct() : mixed
- getCommand() : Command|PluginOwned|null
- getConfig() : Config
- getDataFolder() : string
- Gets the plugin's data folder to save files and configuration.
- getDescription() : PluginDescription
- getFullName() : string
- getInstance() : Main
- getLogger() : AttachableLogger
- getName() : string
- getPluginLoader() : PluginLoader
- getResource() : null|resource
- Gets an embedded resource on the plugin file.
- getResources() : array<string|int, SplFileInfo>
- Returns all the resources packaged with the plugin in the form ["path/in/resources" => SplFileInfo]
- getScheduler() : TaskScheduler
- getServer() : Server
- isDisabled() : bool
- isEnabled() : bool
- onCommand() : bool
- onEnable() : void
- Called when the plugin is enabled
- onLoad() : void
- Called when the plugin is loaded, before calling onEnable()
- reloadConfig() : void
- saveConfig() : void
- saveDefaultConfig() : bool
- saveResource() : bool
- Saves an embedded resource to its relative location in the data folder
- getFile() : string
- onDisable() : void
- Called when the plugin is disabled Use this to free open things and finish actions
- registerYamlCommands() : void
- Registers commands declared in the plugin manifest
Properties
$std
public
static AwaitStd
$std
$config
private
Config|null
$config
= null
$configFile
private
string
$configFile
$dataFolder
private
string
$dataFolder
$description
private
PluginDescription
$description
$file
private
string
$file
$instance
private
static self
$instance
$isEnabled
private
bool
$isEnabled
= false
$loader
private
PluginLoader
$loader
$logger
private
PluginLogger
$logger
$resourceProvider
private
ResourceProvider
$resourceProvider
$scheduler
private
TaskScheduler
$scheduler
$server
private
Server
$server
Methods
__construct()
public
__construct(PluginLoader $loader, Server $server, PluginDescription $description, string $dataFolder, string $file, ResourceProvider $resourceProvider) : mixed
Parameters
- $loader : PluginLoader
- $server : Server
- $description : PluginDescription
- $dataFolder : string
- $file : string
- $resourceProvider : ResourceProvider
Return values
mixed —getCommand()
public
getCommand(string $name) : Command|PluginOwned|null
Parameters
- $name : string
Tags
Return values
Command|PluginOwned|null —getConfig()
public
getConfig() : Config
Return values
Config —getDataFolder()
Gets the plugin's data folder to save files and configuration.
public
final getDataFolder() : string
This directory name has a trailing slash.
Return values
string —getDescription()
public
final getDescription() : PluginDescription
Return values
PluginDescription —getFullName()
public
final getFullName() : string
Return values
string —getInstance()
public
static getInstance() : Main
Return values
Main —getLogger()
public
getLogger() : AttachableLogger
Return values
AttachableLogger —getName()
public
final getName() : string
Return values
string —getPluginLoader()
public
getPluginLoader() : PluginLoader
Return values
PluginLoader —getResource()
Gets an embedded resource on the plugin file.
public
getResource(string $filename) : null|resource
WARNING: You must close the resource given using fclose()
Parameters
- $filename : string
Return values
null|resource —Resource data, or null
getResources()
Returns all the resources packaged with the plugin in the form ["path/in/resources" => SplFileInfo]
public
getResources() : array<string|int, SplFileInfo>
Return values
array<string|int, SplFileInfo> —getScheduler()
public
getScheduler() : TaskScheduler
Return values
TaskScheduler —getServer()
public
final getServer() : Server
Return values
Server —isDisabled()
public
final isDisabled() : bool
Return values
bool —isEnabled()
public
final isEnabled() : bool
Return values
bool —onCommand()
public
onCommand(CommandSender $sender, Command $command, string $label, array<string|int, string> $args) : bool
Parameters
- $sender : CommandSender
- $command : Command
- $label : string
- $args : array<string|int, string>
Return values
bool —onEnable()
Called when the plugin is enabled
public
onEnable() : void
Return values
void —onLoad()
Called when the plugin is loaded, before calling onEnable()
public
onLoad() : void
Return values
void —reloadConfig()
public
reloadConfig() : void
Return values
void —saveConfig()
public
saveConfig() : void
Return values
void —saveDefaultConfig()
public
saveDefaultConfig() : bool
Return values
bool —saveResource()
Saves an embedded resource to its relative location in the data folder
public
saveResource(string $filename[, bool $replace = false ]) : bool
Parameters
- $filename : string
- $replace : bool = false
Return values
bool —getFile()
protected
getFile() : string
Return values
string —onDisable()
Called when the plugin is disabled Use this to free open things and finish actions
protected
onDisable() : void
Return values
void —registerYamlCommands()
Registers commands declared in the plugin manifest
private
registerYamlCommands() : void