Skip to content

Instantly share code, notes, and snippets.

@msjyoo
Last active August 29, 2015 14:21
Show Gist options
  • Save msjyoo/3a852829639d31ed89f4 to your computer and use it in GitHub Desktop.
Save msjyoo/3a852829639d31ed89f4 to your computer and use it in GitHub Desktop.
The public specification of pocketmine-config.

pocketmine-config

This document describes the public specification of pocketmine-config, a YAML defined file to allow for a state based initialisation of a PocketMine server.

File Format

A pocketmine-config file must be in a YAML format, with a file extension of either .yml or .yaml. The first line of a pocketmine-config file must start with a declaration of #pocketmine-config, followed by the YAML standard trible hyphen to denote the start of a YAML file.

Example:

#pocketmine-config
---
YAML content goes here...

Features

  • Change any setting present in the server.properties file
    • Set the MOTD (hostname) of the server
    • Set the max player count of the server
    • Enable / set the rcon password
    • etc...
  • Change any setting present in the pocketmine.yml file
    • Set PocketMine's memory settings
    • Set the number of async workers
    • etc...
  • Autoload plugins in .phar format, available by a public URL
  • Set the configuration of any of the autoloaded plugin where a full configuration file is available.
  • Autoload / lazyload any worlds in a .zip format, available by a public URL
  • Register the status of the PocketMine server's initialisation and optionally any future state afterwards through a public webhook with a predefined API format.
  • Integration with cloud providers, such as Digital Ocean.
  • Importing of the configuration file from a remote address, for example a new instance discovery service.

Configuration Format

Modifying server.properties

Any setting in server.properties can be modified by the pocketmine-config file. The entire server.properties configuration is available under the properties key. Hyphens and dots can be used in pocketmine-config unmodified.

Example:

#pocketmine-config
---
properties:
    motd: "Minecraft PE: Server"
    server-port: 19132
    pvp: on
    rcon.password: "password"

Modifying pocketmine.yml

Any setting in pocketmine.yml can be modified. Since the pocketmine configuration is a YAML file itself, the entire tree of pocketmine.yml can be represented in pocketmine-config without modification. These values can be placed under the pocketmine key.

Example:

#pocketmine-config
---
pocketmine:
    settings:
        language: "eng"
        send-usage: true
    memory:
        global-limit: 512

Autoload plugins

Using pocketmine-config, plugins can be automatically downloaded and placed in the plugins/ folder. Please note that this is done BEFORE PocketMine-MP is started by the bootstrap script. Hot loading of plugins is not supported at this time.

You can specify HTTP URLs of plugins that will be loaded under they key plugins. The plugins listed here will be downloaded sequentially.

Example:

#pocketmine-config
---
plugins:
    - http://forums.pocketmine.net/fakeurl/plugin/1024/download
    - http://api.mcpehostingprovider.com/init/serverid/plugins

Autoload / lazyload worlds

Similarly to plugins, worlds specified here will automatically be downloaded by pocketmine-config. The first world to autoload can be determined by using the properties.level-name key. The key will denote the folder the world will be stored in.

The zipped world file must not contain a subfolder. You may not use a subfolder to name your worlds - use the YAML key instead. Multiple worlds in a single zipped file is also not supported.

The worlds key can be used to denote worlds to download.

Example:

#pocketmine-config
---
properties:
    level-name: lobby # This world will be the default world, and will be auto loaded on startup
    
worlds:
    lobby: http://playmcpe.pvp/worlds/lobby.zip
    nether: http://playmcpe.pvp/worlds/nether.zip
    spleef: http://mcpeworlds.com/download/spleef.zip

Registering status

This feature may be useful to server hosting providers or large server networks where servers are automatically provisioned, and the reporting of their status is needed to present to the user.

pocketmine-config can automatically call a webhook on before bootstrap start and after bootstrap completion.

Webhook URLs can be specified under the key webhooks. The available webhooks are postbootstrap.

Example:

#pocketmine-config
---
webhooks:
    postbootstrap: http://api.mcpehost.com/callback/postbootstrap?secret=abcdef

Importing configuration from remote sources

You can also import configuration from remote sources over HTTP. This feature may be useful if you are, for example, booting up new instances with lazy provisioning. By default the URL you enter is downloaded directly over GET, but you may modify your initialisation script to allow for POST and additional parameters, such as labels, locations, server size etc.

You can only specify one import source under the key import. If you specify the import key, it MUST be the first key on the YAML. If there are duplicates, the option on the file will override the option on the imported configuration. Any keys that can be appended to will be appended, unless the values duplicate. (e.g. plugins)

It is recommended however that you specify only the import option and provide the remaining configuration over the remote source for consistency.

Example:

#pocketmine-config
---
import: http://api.nuclearpowered.net/queue/servers/discovery

License

The MIT License (MIT)

Copyright (c) 2014 Michael Yoo michael@yoo.id.au

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment