PocketMine-MP 5.17.1 git-df4ada81e5d74a14046f27cf44a37dcee69d657e
pocketmine\plugin\PluginBase Class Reference
+ Inheritance diagram for pocketmine\plugin\PluginBase:
+ Collaboration diagram for pocketmine\plugin\PluginBase:

Public Member Functions

 __construct (private PluginLoader $loader, private Server $server, private PluginDescription $description, private string $dataFolder, private string $file, private ResourceProvider $resourceProvider)
 getCommand (string $name)
 getConfig ()
 getDataFolder ()
 getDescription ()
 getFullName ()
 getLogger ()
 getName ()
 getPluginLoader ()
 getResource (string $filename)
 getResourceFolder ()
 getResourcePath (string $filename)
 getResources ()
 getScheduler ()
 getServer ()
 isDisabled ()
 isEnabled ()
 onCommand (CommandSender $sender, Command $command, string $label, array $args)
 onEnableStateChange (bool $enabled)
 reloadConfig ()
 saveConfig ()
 saveDefaultConfig ()
 saveResource (string $filename, bool $replace=false)

Protected Member Functions

 getFile ()
 onDisable ()
 onEnable ()
 onLoad ()

Detailed Description

Definition at line 47 of file PluginBase.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\plugin\PluginBase::__construct ( private PluginLoader  $loader,
private Server  $server,
private PluginDescription  $description,
private string  $dataFolder,
private string  $file,
private ResourceProvider  $resourceProvider 

Definition at line 58 of file PluginBase.php.

Member Function Documentation

◆ getCommand()

pocketmine\plugin\PluginBase::getCommand ( string  $name)
Command|PluginOwned|null @phpstan-return (Command&PluginOwned)|null

Definition at line 192 of file PluginBase.php.

References pocketmine\server().

+ Here is the call graph for this function:

◆ getConfig()

pocketmine\plugin\PluginBase::getConfig ( )

Definition at line 277 of file PluginBase.php.

◆ getDataFolder()

pocketmine\plugin\PluginBase::getDataFolder ( )

Gets the plugin's data folder to save files and configuration. This directory name has a trailing slash.

Implements pocketmine\plugin\Plugin.

Definition at line 130 of file PluginBase.php.

◆ getDescription()

pocketmine\plugin\PluginBase::getDescription ( )

Implements pocketmine\plugin\Plugin.

Definition at line 134 of file PluginBase.php.

◆ getFile()

pocketmine\plugin\PluginBase::getFile ( )

Definition at line 313 of file PluginBase.php.

◆ getFullName()

pocketmine\plugin\PluginBase::getFullName ( )

Definition at line 309 of file PluginBase.php.

◆ getLogger()

pocketmine\plugin\PluginBase::getLogger ( )

Implements pocketmine\plugin\Plugin.

Definition at line 138 of file PluginBase.php.

◆ getName()

pocketmine\plugin\PluginBase::getName ( )

Implements pocketmine\plugin\Plugin.

Definition at line 305 of file PluginBase.php.

◆ getPluginLoader()

pocketmine\plugin\PluginBase::getPluginLoader ( )

Implements pocketmine\plugin\Plugin.

Definition at line 317 of file PluginBase.php.

◆ getResource()

pocketmine\plugin\PluginBase::getResource ( string  $filename)
Prefer using standard PHP functions with PluginBase::getResourcePath(), like file_get_contents() or fopen().

Gets an embedded resource on the plugin file. WARNING: You must close the resource given using fclose()

null|resource Resource data, or null

Definition at line 239 of file PluginBase.php.

◆ getResourceFolder()

pocketmine\plugin\PluginBase::getResourceFolder ( )

Returns the path to the folder where the plugin's embedded resource files are usually located. Note: This is NOT the same as the data folder. The files in this folder should be considered read-only.

Definition at line 216 of file PluginBase.php.

◆ getResourcePath()

pocketmine\plugin\PluginBase::getResourcePath ( string  $filename)

Returns the full path to a data file in the plugin's resources folder. This path can be used with standard PHP functions like fopen() or file_get_contents().

Note: Any path returned by this function should be considered READ-ONLY.

Definition at line 226 of file PluginBase.php.

◆ getResources()

pocketmine\plugin\PluginBase::getResources ( )

Returns all the resources packaged with the plugin in the form ["path/in/resources" => SplFileInfo]


Definition at line 273 of file PluginBase.php.

◆ getScheduler()

pocketmine\plugin\PluginBase::getScheduler ( )

Implements pocketmine\plugin\Plugin.

Definition at line 321 of file PluginBase.php.

◆ getServer()

pocketmine\plugin\PluginBase::getServer ( )

Definition at line 301 of file PluginBase.php.

◆ isDisabled()

pocketmine\plugin\PluginBase::isDisabled ( )

Definition at line 126 of file PluginBase.php.

◆ isEnabled()

pocketmine\plugin\PluginBase::isEnabled ( )

Implements pocketmine\plugin\Plugin.

Definition at line 104 of file PluginBase.php.

◆ onCommand()

pocketmine\plugin\PluginBase::onCommand ( CommandSender  $sender,
Command  $command,
string  $label,
array  $args 

Implements pocketmine\command\CommandExecutor.

Definition at line 208 of file PluginBase.php.

◆ onDisable()

pocketmine\plugin\PluginBase::onDisable ( )

Called when the plugin is disabled Use this to free open things and finish actions

Definition at line 100 of file PluginBase.php.

◆ onEnable()

pocketmine\plugin\PluginBase::onEnable ( )

Called when the plugin is enabled

Definition at line 92 of file PluginBase.php.

◆ onEnableStateChange()

pocketmine\plugin\PluginBase::onEnableStateChange ( bool  $enabled)

Called by the plugin manager when the plugin is enabled or disabled to inform the plugin of its enabled state.

Implements pocketmine\plugin\Plugin.

Definition at line 115 of file PluginBase.php.

◆ onLoad()

pocketmine\plugin\PluginBase::onLoad ( )

Called when the plugin is loaded, before calling onEnable()

Definition at line 85 of file PluginBase.php.

◆ reloadConfig()

pocketmine\plugin\PluginBase::reloadConfig ( )

Definition at line 296 of file PluginBase.php.

◆ saveConfig()

pocketmine\plugin\PluginBase::saveConfig ( )

Definition at line 285 of file PluginBase.php.

◆ saveDefaultConfig()

pocketmine\plugin\PluginBase::saveDefaultConfig ( )

Definition at line 289 of file PluginBase.php.

◆ saveResource()

pocketmine\plugin\PluginBase::saveResource ( string  $filename,
bool  $replace = false 

Saves an embedded resource to its relative location in the data folder

Definition at line 246 of file PluginBase.php.

The documentation for this class was generated from the following file: