-
-
Save shoghicp/516105d470cf7d140757 to your computer and use it in GitHub Desktop.
<?php | |
/** | |
* This file is an example of a compressed plaintext plugin format for PocketMine | |
* It's aimed towards easy scripting, but not for normal plugin development. | |
* | |
* This kind of plugin won't be able to embed/load resources, | |
* nor have access to some features like fast permission/command integration. | |
* | |
* This first comment is used to define the properties like on plugin.yml, | |
* having the same name but not being able to define complex types (arrays, multi-line strings) | |
* | |
* @name MyPlugin | |
* @main authorName\MyPlugin\MainClass | |
* @version 1.0.0 | |
* @api 1.12.0 | |
* @description My super plugin | |
* @author authorName | |
*/ | |
//If you want to use multiple namespaces per file you've to use this. | |
namespace authorName\MyPlugin{ | |
use authorName\MyPlugin\MyTasks\NotifyAlive; | |
use pocketmine\event\Listener; | |
use pocketmine\event\player\PlayerJoinEvent; | |
use pocketmine\plugin\PluginBase; | |
class MainClass extends PluginBase{ | |
public function onEnable(){ | |
$this->getLogger()->info("I've been enabled!"); | |
$this->getServer()->getScheduler()->scheduleRepeatingTask(new NotifyAlive($this), 40); | |
$this->getServer()->getPluginManager()->registerEvents(new PlayerListener(), $this); | |
} | |
} | |
class PlayerListener implements Listener{ | |
public function onPlayerJoined(PlayerJoinEvent $event){ | |
$event->getPlayer()->sendMessage("I'm enabled!"); | |
} | |
} | |
} | |
namespace authorName\MyPlugin\MyTasks{ | |
use pocketmine\scheduler\PluginTask; | |
class NotifyAlive extends PluginTask{ | |
public function onRun($currentTick){ | |
$this->getOwner()->getLogger()->info("I'm still enabled!"); | |
} | |
} | |
} |
Is there any good tutorials on how to develop pocketmine plugins from basics to expert? 💫
Yay! 😄
Now its more like JavaScript and less like Java
Support PMF or something like that?
Read. Just read this. https://forums.pocketmine.net/threads/new-plugin-scripting-format-draft.8335/
Also it is a forum post not a blog post I guess.
@shoghicp I am more interested in the loader. Where is it?
@PEMapModder It's on 1.5 already
I have a error
[Server] [03:19:27] [Server thread/INFO]: Enabling DevTools v1.10.0
[Server] [03:19:27] [Server thread/ERROR]: Could not load '/storage/emulated/0/PocketMine/plugins/Advert' in folder '/storage/emulated/0/PocketMine/plugins/': yaml_parse(): scanning error encountered during parsing: could not find expected ':' (line 10, column 1), context while scanning a simple key (line 9, column 1)
[Server] [03:19:27] [Server thread/WARNING]: RuntimeException: "yaml_parse(): scanning error encountered during parsing: could not find expected ':' (line 10, column 1), context while scanning a simple key (line 9, column 1)" (E_WARNING) in "/src/pocketmine/plugin/PluginDescription" at line 2
@Palente that is to do with the plugin you are using. You should be discussing this on the plugin's page whatever advert is not here as it is not the developers of pocketmine's fault. Just go on the github page for that 'Advert' plugin. We cannot help you with someone else's plugin. Sorry!
It will be awesome but still after the update can we have the both methods for the plugins