Update PluginTemplate
This commit is contained in:
parent
836a573995
commit
e51fb0b8c5
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Plugin",
|
|
||||||
|
"name": "Plugin name for PHAR building and loading",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": {
|
"main": {
|
||||||
"path": "src/Plugin.php",
|
"path": "src/Plugin.php",
|
||||||
|
@ -1,13 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
//Namespace from plugin.json
|
||||||
namespace Plugin;
|
namespace Plugin;
|
||||||
|
//Import PluginBase
|
||||||
use LonaDB\Plugins\PluginBase;
|
use LonaDB\Plugins\PluginBase;
|
||||||
|
//Class name from plugin.json
|
||||||
class MainClass extends PluginBase
|
class MainClass extends PluginBase
|
||||||
{
|
{
|
||||||
|
//The onEnable funciton is always run once the plugin has been loaded
|
||||||
|
//You should use this as your constructor
|
||||||
public function onEnable() : void
|
public function onEnable() : void
|
||||||
{
|
{
|
||||||
$this->GetLogger()->Load($this->GetName() . " has been enabled");
|
$this->GetLogger()->Load($this->GetName() . " on version " . $this->GetVersion() . " has been enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
//You can create your own event handling:
|
||||||
|
public function onTableCreate(string $executor, string $name) : void {
|
||||||
|
$this->GetLogger()->Plugin($this->GetName(), "A table has been created: " . $name)
|
||||||
|
}
|
||||||
|
public function onTableDelete(string $executor, string $name) : void {
|
||||||
|
$this->GetLogger()->Plugin($this->GetName(), "A table has been deleted: " . $name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user