Skip to content

Getting started ​

VanillaMine plugins are PocketMine-MP 5 plugins. Everything you know about PocketMine plugins applies, and plugins written for PocketMine-MP 5.44.3 run unchanged.

A minimal plugin ​

MyPlugin/
├── plugin.yml
└── src/
    └── Main.php

plugin.yml:

yaml
name: MyPlugin
version: 1.0.0
main: myname\myplugin\Main
src-namespace-prefix: myname\myplugin
api: 5.0.0
description: Says hello.

src/Main.php:

php
<?php

declare(strict_types=1);

namespace myname\myplugin;

use pocketmine\event\Listener;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\plugin\PluginBase;

final class Main extends PluginBase implements Listener{
	protected function onEnable() : void{
		$this->getServer()->getPluginManager()->registerEvents($this, $this);
	}

	public function onJoin(PlayerJoinEvent $event) : void{
		$event->getPlayer()->sendMessage("Hello, " . $event->getPlayer()->getName());
	}
}

Running it while you develop ​

Put the folder in plugins/ together with the DevTools plugin, which loads plugins from source folders, or build a .phar and drop it in plugins/.

Which API version to declare ​

Declare api: 5.0.0 unless you use something newer. If you use an addition from VanillaMine, declare the version that added it (the badge in the reference), e.g. api: 5.46.0: older servers then refuse the plugin with a clear message instead of crashing. You can also check at runtime:

php
if($this->getServer()->getProxyNetwork() !== null){ /* ... */ }

Where to go next ​

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.