◆ getCommand()
- Parameters
-
- Returns
- Command|PluginIdentifiableCommand
154 $command = $this->
getServer()->getPluginCommand($name);
155 if($command === null or $command->getPlugin() !== $this){
156 $command = $this->
getServer()->getPluginCommand(strtolower($this->description->getName()) .
":" . $name);
159 if($command instanceof PluginIdentifiableCommand and $command->getPlugin() === $this){
◆ getConfig()
- Returns
- Config
Implements Plugin.
252 if(!isset($this->config)){
256 return $this->config;
◆ getDataFolder()
- Returns
- string
Implements Plugin.
104 return $this->dataFolder;
◆ getDescription()
◆ getFile()
◆ getFullName()
- Returns
- string
306 return $this->description->getFullName();
◆ getLogger()
◆ getName()
- Returns
- string
Implements Plugin.
299 return $this->description->getName();
◆ getPluginLoader()
◆ getResource()
Gets an embedded resource on the plugin file. WARNING: You must close the resource given using fclose()
- Parameters
-
- Returns
- resource Resource data, or null
Implements Plugin.
194 $filename = rtrim(str_replace(
"\\",
"/", $filename),
"/");
195 if(file_exists($this->file .
"resources/" . $filename)){
196 return fopen($this->file .
"resources/" . $filename,
"rb");
◆ getResources()
Returns all the resources packaged with the plugin
- Returns
- string[]
Implements Plugin.
239 if(is_dir($this->file .
"resources/")){
240 foreach(
new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($this->file .
"resources/")) as $resource){
241 $resources[] = $resource;
◆ getServer()
◆ init()
- Parameters
-
122 if($this->initialized ===
false){
123 $this->initialized =
true;
124 $this->loader = $loader;
125 $this->server = $server;
126 $this->description = $description;
127 $this->dataFolder = rtrim($dataFolder,
"\\/") .
"/";
128 $this->file = rtrim($file,
"\\/") .
"/";
129 $this->configFile = $this->dataFolder .
"config.yml";
130 $this->logger =
new PluginLogger($this);
◆ isDisabled()
- Returns
- bool
Implements Plugin.
◆ isEnabled()
- Returns
- bool
Implements Plugin.
◆ isInitialized()
- Returns
- bool
145 return $this->initialized;
◆ isPhar()
- Returns
- bool
182 return substr($this->file, 0, 7) ===
"phar://";
◆ onCommand()
- Parameters
-
CommandSender | $sender | |
Command | $command | |
string | $label | |
array | $args | |
- Returns
- bool
Implements CommandExecutor.
◆ onDisable()
Called when the plugin is disabled Use this to free open things and finish actions
Implements Plugin.
◆ onEnable()
Called when the plugin is enabled
Implements Plugin.
◆ onLoad()
◆ reloadConfig()
- Returns
- mixed
Implements Plugin.
281 $this->config =
new Config($this->configFile);
282 if(($configStream = $this->
getResource(
"config.yml")) !== null){
284 fclose($configStream);
◆ saveConfig()
- Returns
- mixed
Implements Plugin.
263 if($this->
getConfig()->save() ===
false){
264 $this->
getLogger()->critical(
"Could not save config to " . $this->configFile);
◆ saveDefaultConfig()
- Returns
- mixed
Implements Plugin.
272 if(!file_exists($this->configFile)){
◆ saveResource()
saveResource |
( |
|
$filename, |
|
|
|
$replace = false |
|
) |
| |
- Parameters
-
string | $filename | |
bool | $replace | |
- Returns
- bool
Implements Plugin.
209 if(trim($filename) ===
""){
213 if(($resource = $this->
getResource($filename)) === null){
217 $out = $this->dataFolder . $filename;
218 if(!file_exists(dirname($out))){
219 mkdir(dirname($out), 0755,
true);
222 if(file_exists($out) and $replace !==
true){
226 $ret = stream_copy_to_stream($resource, $fp = fopen($out,
"wb")) > 0;
◆ setEnabled()
setEnabled |
( |
|
$boolean = true | ) |
|
|
final |
The documentation for this class was generated from the following file:
- src/pocketmine/plugin/PluginBase.php