Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of new plugin format aimed for easy scripting.
<?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!");
}
}
}
@ghost

This comment has been minimized.

Copy link

ghost commented May 9, 2015

Noice

@Asparanc

This comment has been minimized.

Copy link

Asparanc commented May 9, 2015

It will be great but can we (after the update) use the 2 methods for plugins ?

@shoghicp

This comment has been minimized.

Copy link
Owner Author

shoghicp commented May 9, 2015

@Asparanc check this blog post for more details.

@ghost

This comment has been minimized.

Copy link

ghost commented May 10, 2015

@shoghicp Will you still be able to do plugins in phars like we can now?

@Sharkcraft

This comment has been minimized.

Copy link

Sharkcraft commented May 10, 2015

It will be awesome but still after the update can we have the both methods for the plugins

@XCodexDev

This comment has been minimized.

Copy link

XCodexDev commented May 11, 2015

Is there any good tutorials on how to develop pocketmine plugins from basics to expert? 💫

@AndreyNazarchuk

This comment has been minimized.

Copy link

AndreyNazarchuk commented May 12, 2015

Yay! 😄 ☺️
Now its more like JavaScript and less like Java

@kevin200

This comment has been minimized.

Copy link

kevin200 commented May 17, 2015

Support PMF or something like that?

@PEMapModder

This comment has been minimized.

Copy link

PEMapModder commented May 26, 2015

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.

@PEMapModder

This comment has been minimized.

Copy link

PEMapModder commented May 26, 2015

@shoghicp I am more interested in the loader. Where is it?

@shoghicp

This comment has been minimized.

Copy link
Owner Author

shoghicp commented Jun 7, 2015

@PEMapModder It's on 1.5 already

@Palente

This comment has been minimized.

Copy link

Palente commented Apr 14, 2016

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

@StarProgamGamer

This comment has been minimized.

Copy link

StarProgamGamer commented May 12, 2016

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.