Quick Start Guide
This guide will help you get your PocketMine-MP server running and create your first simple plugin.
Prerequisites
Starting Your Server
Navigate to Server Directory
Open a terminal and navigate to your PocketMine-MP installation directory:
Start the Server
Run the start script: Linux/macOS
Windows
Direct PHP
Complete Setup Wizard
On first run, you’ll see the setup wizard: [*] PocketMine-MP set-up wizard
[*] Please select a language:
Follow the prompts to configure:
Language
Server name
Port (default: 19132)
Maximum players
Game mode (Survival, Creative, Adventure)
Generate default world
Wait for Server to Start
You’ll see: [Server thread/INFO]: Done (X.XXXs)! For help, type "help" or "?"
Your server is now running!
Connecting to Your Server
Open Minecraft Bedrock Edition
Launch Minecraft on your device (Windows 10/11, Android, iOS, Xbox, PlayStation, or Switch)
Go to Servers Tab
Navigate to the “Play” menu, then select the “Servers” tab
Add Server
Click “Add Server” and enter:
Server Name : Your choice
Server Address : localhost (if on same machine) or your server’s IP
Port : 19132 (default)
Join Server
Click on your server to join!
If connecting from another device, make sure port 19132 is open in your firewall and use your server’s local IP address (e.g., 192.168.1.100).
Basic Server Commands
Use these commands in the server console:
# Stop the server
stop
# List online players
list
# Give a player operator permissions
op < player_nam e >
# Remove operator permissions
deop < player_nam e >
# Kick a player
kick < player_nam e > [reason]
# Ban a player
ban < player_nam e > [reason]
# Reload the server (not recommended during production)
reload
# View server status
status
# Save all worlds
save-all
Server Configuration
server.properties
Key settings in server.properties:
# Server name shown in server list
server-name =PocketMine-MP Server
# Game mode (0=Survival, 1=Creative, 2=Adventure, 3=Spectator)
gamemode =0
# Difficulty (0=Peaceful, 1=Easy, 2=Normal, 3=Hard)
difficulty =1
# Maximum players
max-players =20
# Server port
server-port =19132
# Enable whitelist
white-list =off
# View distance
view-distance =8
pocketmine.yml
Advanced settings in pocketmine.yml:
settings :
# Server language
force-language : false
# Shutdown message
shutdown-message : "Server closed"
# Enable plugin profiling
enable-profiling : false
# AsyncTask workers (set to CPU cores)
async-workers : auto
memory :
# Global memory limit (MB, 0 to disable)
global-limit : 0
# Main thread hard memory limit (MB)
main-hard-limit : 1024
Creating Your First Plugin
Let’s create a simple plugin that welcomes players when they join.
Plugin Structure
PocketMine-MP plugins can be:
Folder plugins (source code in folders)
PHAR plugins (compiled archives)
Script plugins (single PHP files)
For development, use folder plugins. For distribution, compile to PHAR using DevTools.
Script Plugin Example
Create a simple script plugin to get started quickly:
Create Plugin File
Navigate to your plugins directory and create WelcomePlugin.php: cd plugins
touch WelcomePlugin.php
Write Plugin Code
Edit WelcomePlugin.php: <? php
namespace MyPlugins\WelcomePlugin ;
use pocketmine\event\ Listener ;
use pocketmine\event\player\ PlayerJoinEvent ;
use pocketmine\plugin\ PluginBase ;
use pocketmine\utils\ TextFormat ;
/**
* @main MyPlugins\WelcomePlugin\Main
* @api 5.0.0
* @name WelcomePlugin
* @version 1.0.0
*/
class Main extends PluginBase implements Listener {
public function onEnable () : void {
$this -> getServer () -> getPluginManager () -> registerEvents ( $this , $this );
$this -> getLogger () -> info ( "WelcomePlugin enabled!" );
}
public function onPlayerJoin ( PlayerJoinEvent $event ) : void {
$player = $event -> getPlayer ();
$player -> sendMessage (
TextFormat :: GREEN . "Welcome to the server, " .
$player -> getName () . "!"
);
$this -> getLogger () -> info (
$player -> getName () . " joined the server"
);
}
}
Restart Server
Restart your server or use the reload command: You should see: [Server thread/INFO]: [WelcomePlugin] WelcomePlugin enabled!
Test the Plugin
Join the server with a player. You should see a green welcome message!
Understanding the Plugin Code
Let’s break down the key components:
/**
* @main MyPlugins\WelcomePlugin\Main
* @api 5.0.0
* @name WelcomePlugin
* @version 1.0.0
*/
@main: Fully qualified class name of your main class
@api: Minimum API version required
@name: Plugin name (optional for script plugins)
@version: Plugin version (optional for script plugins)
Plugin Base Class
class Main extends PluginBase implements Listener
Extend PluginBase for basic plugin functionality
Implement Listener to listen to events
Event Registration
public function onEnable () : void {
$this -> getServer () -> getPluginManager () -> registerEvents ( $this , $this );
}
onEnable() is called when the plugin is enabled
Register the plugin as an event listener
Event Handling
public function onPlayerJoin ( PlayerJoinEvent $event ) : void {
$player = $event -> getPlayer ();
$player -> sendMessage ( "Welcome!" );
}
Method name doesn’t matter for event handlers
Type hint the specific event class you want to handle
Access event data and perform actions
Folder Plugin Example
For more complex plugins, use the folder structure:
plugins/
└── MyPlugin/
├── plugin.yml
├── src/
│ └── MyPlugins/
│ └── MyPlugin/
│ └── Main.php
└── resources/
└── config.yml
plugin.yml
name : MyPlugin
main : MyPlugins\MyPlugin\Main
version : 1.0.0
api : [ 5.0.0 ]
author : YourName
description : My awesome plugin
permissions :
myplugin.command :
description : Allow using the plugin command
default : true
commands :
mycommand :
description : Test command
usage : "/mycommand"
permission : myplugin.command
Main.php
src/MyPlugins/MyPlugin/Main.php
<? php
namespace MyPlugins\MyPlugin ;
use pocketmine\plugin\ PluginBase ;
use pocketmine\command\ Command ;
use pocketmine\command\ CommandSender ;
class Main extends PluginBase {
public function onEnable () : void {
$this -> saveDefaultConfig ();
$this -> getLogger () -> info ( "MyPlugin enabled!" );
}
public function onCommand (
CommandSender $sender ,
Command $command ,
string $label ,
array $args
) : bool {
if ( $command -> getName () === "mycommand" ) {
$sender -> sendMessage ( "Hello from MyPlugin!" );
return true ;
}
return false ;
}
}
Installing Plugins from Poggit
Download Plugin
Find a plugin and download the .phar file
Install Plugin
Place the .phar file in your plugins/ directory: cp DownloadedPlugin.phar /path/to/pocketmine/plugins/
Restart Server
Restart the server to load the plugin:
Next Steps
Developer Documentation Learn advanced plugin development
API Documentation Browse the complete API reference
Example Plugin Study a complete example plugin
DevTools Build and package plugins
Common Issues
Plugin Not Loading
Check the server console for errors. Common issues:
Wrong API version in plugin metadata
Syntax errors in PHP code
Missing dependencies
Incorrect file permissions
Events Not Firing
Make sure you:
Implement the Listener interface
Register events in onEnable()
Type-hint the correct event class
Cannot Connect to Server
Check:
Server is running (no errors in console)
Using correct IP and port
Firewall allows UDP traffic on port 19132
Server and client are on compatible versions