Вы находитесь на странице: 1из 69

Extendable Minecraft Server Manager

Documentation
Release 4.0.13-beta

Benedikt Schmitt

November 02, 2015

Contents

How to
1.1 Installation .
1.2 Configuration
1.3 First steps . .
1.4 Updates . . .

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

1
1
2
4
5

Plugins
2.1 emsm.plugins.backups . .
2.2 emsm.plugins.emsm . . . .
2.3 emsm.plugins.guard . . . .
2.4 emsm.plugins.hellodolly
2.5 emsm.plugins.initd . . . .
2.6 emsm.plugins.plugins . .
2.7 emsm.plugins.server . . .
2.8 emsm.plugins.worlds . . .
2.9 What are EMSM plugins? . . . .
2.10 How to write a plugin . . . . . .

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.

7
7
8
9
10
16
18
19
20
22
22

API
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
3.11
3.12

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.

23
23
24
25
27
29
29
29
32
34
37
37
42

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

emsm.core.application
emsm.core.argparse_ . .
emsm.core.base_plugin
emsm.core.conf . . . . . .
emsm.core.license_ . . .
emsm.core.logging_ . . .
emsm.core.paths . . . . .
emsm.core.plugins . . .
emsm.core.server . . . .
emsm.core.version . . .
emsm.core.worlds . . . .
About the depencies . . . . . .

.
.
.
.
.
.
.
.
.
.
.
.

Changelog

43

Contribute
5.1 Bug reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45
45
45
45

5.4

Spelling Mistakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46

License
6.1 Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

47
47
47

About
7.1 Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

49
49

Indices and tables

51

What is the EMSM ?

53

10 Why should you use the EMSM?

55

11 Collaboration

57

Python Module Index

59

ii

CHAPTER 1

How to

1.1 Installation
1. Update the system packages:
$ sudo apt-get update
$ sudo apt-get upgrade

2. Install the depencies:


$ sudo apt-get install python3 python3-pip screen openjdk-7-jre-headless

Note, that the EMSM needs at least Python 3.2 to run.


3. Install the EMSM Python package from PyPi:
$ sudo pip3 install --pre emsm

This will also install all EMSM Python depencies.


4. Create the user, that should run the EMSM:
$ sudo addgroup --system --no-create-home --disabled-login --group minecraft
$ sudo adduser --system --no-create-home --disabled-login --ingroup minecraft minecraft

5. Create the instance folder. This folder will later contain all worlds and server executables:
$ sudo mkdir /opt/minecraft

6. Create the /opt/minecraft/minecraft.py EMSM launcher and add it to the global PATH:
#!/usr/bin/env python3
#/opt/minecraft/minecraft.py
import emsm
# Make sure, the instance dir is correct.
emsm.run(instance_dir="/opt/minecraft")
$ sudo chmod +x /opt/minecraft/minecraft.py
$ sudo ln -s /opt/minecraft/minecraft.py /usr/bin/minecraft

7. Make sure the /opt/minecraft/ directory is owned by the minecraft user:

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

$ sudo chown -R minecraft:minecraft /opt/minecraft

8. Execute the EMSM:


$ sudo minecraft emsm --version

9. Thats it. Your instance directory should now look like this:
|- /opt/minecraft
|- conf
|- logs
|- minecraft.py
|- plugins
|- plugins_data
|- server
|- worlds

You probably want to use some plugins like the guard, initd or backups plugin. So dont forget to take a look
at their documentation later.

1.1.1 Troubleshooting
WrongUserError
If you run the application under another user than minecraft, you have to edit the conf/main.conf configuration
file before you call the EMSM the first time otherwise you will get a WrongUserError:
[emsm]
user = foobar

1.2 Configuration
The conf/ directory contains all configuration files.

1.2.1 main.conf
The main.conf file contains the configuration of the EMSM and the plugins.
[emsm]
# User that should run all of your minecraft worlds.
user = minecraft
# Maximum time that is waited until another EMSM instance releases
# the file lock.
# A negative values means no timeout and wait endless if necessairy.
timeout = -1
# You can provide a *screenrc* file. Please note, that it must be an
# **absolute** path.
# This option is optional.
#
#screenrc = /opt/minecraft/conf/screenrc
screenrc =

Chapter 1. How to

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Each plugin has its own section. E.g.:


[backups]
archive_format = bztar
restore_message = This world is about to be resetted to an earlier state.
restore_delay = 5
max_storage_size = 30
include_server = yes

Please take a look at the documentation of the Plugins for further information.

1.2.2 server.conf
The server.conf allows you to adjust some properties of the internal EMSM server wrapper classes. Usually, it
should not be necessairy to edit this configuraiton file, but some times you have to.
Examples
You want to adjust the java heap size:
[vanilla 1.8]
# You can use these placeholders in the start_command:
# * {server_exe}
# * {server_dir}
start_command = java -Xmx3G -jar {server_exe}

You want to use the latest server version, but the EMSM contains an old url:
[vanilla 1.8]
url = https://...

Make sure to update the server after changing the configuration:


$ minecraft -s "vanilla 1.8" server --update

1.2.3 worlds.conf
The worlds managed by the EMSM have to be declared in the worlds.conf configuration file. Each section
represents another world.
The worlds.conf configuration file contains only the EMSM configuration for the worlds. You still have to edit
the server.properties file in the worlds directory.
[the world's name]
stop_timeout = 10
stop_message = The world is going to be stopped.
stop_delay = 10
server = vanilla 1.8

stop_timeout
The maximum time, waited until the world stopped after sending the stop command.
stop_message
This message is printed before sending the stop command to the world.

1.2. Configuration

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

stop_delay
The time between the sending the stop_message and the stop command. If stop_delay and stop_timeout are
both 10, the stop takes at least 10 seconds and at maximum 20.
server
The name of the minecraft server that should power this world.
Run minecraft server --list to get a list of all supported minecraft server. If your server is not listed,
you can create a new plugin, which provides a server wrapper.
Example
# This section contains the default values for all worlds.
# It is not a real world.
[DEFAULT]
stop_delay = 5
stop_timeout = 10
stop_message = The server is going down.
Hope to see you soon.
server = vanilla 1.8
[foo]
# This ok, when all default values are set and valid.
[bar]
stop_delay = 0
stop_timeout = 20
stop_message = See you later aligator.
server = vanilla 1.5
[lobby]
server = bungeecord

Some plugins like initd provide additional configuration options:


[foo]
# InitD has to be enabled for each world or once in the DEFAULT section.
enable_initd = yes

1.3 First steps


There are some common arguments and run types you should know:
The help argument:
$ minecraft
$ minecraft
$ minecraft
$ minecraft
...

-h
worlds -h
server -h
backups -h

The long-help argument:


$ minecraft worlds --long-help
$ minecraft backups --long-help
...

Chapter 1. How to

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Each plugin provides its own arguments, similar to git. There are only a few global arguments to unify the interface:
Select all worlds:
$ minecraft -W [plugin ...]
$ minecraft --all-worlds [plugin ...]

Select world by world:


$ minecraft -w foo -w bar [plugin ...]
$ minecraft --world foo --world bar [plugin ...]

Select all server software:


$ minecraft -S [plugin ...]
$ minecraft --all-server [plugin ...]

Select server by server:


$ minecraft -s vanilla -s bukkit [plugin ...]
$ minecraft --server vanilla --server bukkit [plugin ...]

1.3.1 Common tasks


Start all worlds:
$ minecraft -W worlds --start
$ minecraft --all-worlds worlds --start

Restart one world:


$ minecraft -w foo worlds --restart
$ minecraft --world foo worlds --restart
$ minecraft -w foo worlds --force-restart

Stop all worlds:


$ minecraft -W worlds --stop
$ minecraft --all-worlds worlds --stop

Server update:
$ minecraft -S server --update
$ minecraft -s "vanilla 1.8" server --update
$ minecraft --server "vanilla 1.8" server --update

1.4 Updates
From time to time, the EMSM receives some updates. Especially the server database and the server download urls. So
how can you update the EMSM?

1.4.1 Server updates


The server software is usually updated faster than the EMSM database. But dont worry, you can often use the latest
server software with the EMSM.
Lets assume, the minecraft server 1.8 received a patch from mojang and you want to use it:
1.4. Updates

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

1. Edit the server.conf configuration file:


[vanilla 1.8]
# Setting the url here, will overwrite the value in the EMSM database.
url = https://s3.amazonaws.com/Minecraft.Download/versions/1.8.1/minecraft_server.1.8.1.jar

1. Update the server with the server plugin:


$ minecraft -s "vanilla 1.8" server --update

If the update fails, the old server software will be restored and nothing changed.
Please take a look at the server configuration and the server plugin for more information.

1.4.2 EMSM updates


The EMSM is a Python package and you can simply update it using pip:
$ pip3 install --upgrade emsm

Since the instance folder is not touched by this command, there is no need for a backup before an update anymore.
If the EMSM does not work as expected after the update, take a look at the Changelog or create an issue.

1.4.3 Upgrade
If the major version number changes, you should take a look at the Changelog first. There will be an upgrade guide
and additional information.
This is a quick installation guide. I guess it will not take more than 15 minutes to set the application up and learn how
it works.

Chapter 1. How to

CHAPTER 2

Plugins

2.1 emsm.plugins.backups
2.1.1 About
Extends the EMSM by a backup manager.

2.1.2 Download
You can find the latest version of this plugin in the EMSM GitHub repository.

2.1.3 Configuration
[backups]
archive_format = bztar
restore_message = This world is about to be ressetted to an earlier state.
restore_delay = 5
max_storage_size = 30
backup_logs = yes

archive_format
Is the name of the archive format used to create the backups. This string has to be listed in
shutil.get_archive_formats(). Usually, there should be at least zip or tar available.
restore_message
Is send to the worlds chat before restoring the world.
restore_delay
Seconds between sending the restore_message to the chat and starting the restore.
max_storage_size
Maximum number of backups in the storage folder, before older backups will be removed.
backup_logs
If yes, the log files are included into the backup, otherwise not.

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

2.1.4 Arguments
Note: All arguments will only affect the worlds selected with world or all-world
--list
Lists all available backups.
--create
Creates a new backup.
--restore PATH
Restores the world with the backup from the given BACKUP_PATH.
--restore-latest
Restores, if available, the latest backup of the world.
--restore-menu
Opens a menu, where the user can select which backup he wants to restore.

2.1.5 Cron
You should create a cronjob to create daily backups:
# m h dom mon dow user command
# Creates a backup of all worlds everyday at 2:00h
0 2 *
root minecraft -W backups --create
*
*

2.1.6 Backup archive structure


A typical backup archive has this structure:
o
|- world_conf.json
|- world
|- server.log
|- server.properties
|- ...

# The EMSM configuration of the world


# the minecraft world

2.1.7 Changelog
EMSM v3
changed package structure and dropped support for EMSM v2 backups.

2.2 emsm.plugins.emsm
2.2.1 About
Provides information about the EMSM itself, like the version and simplifies the EMSM update.

Chapter 2. Plugins

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

2.2.2 Download
You can find the latest version of this plugin in the EMSM GitHub repository.

2.2.3 Arguments
--version
Shows the current EMSM version number.
--license
Shows the EMSM license.
--check-update
Simulates an EMSM update.

2.3 emsm.plugins.guard
2.3.1 About
Monitors selected worlds (world, -w, -W) and reacts on issues.

2.3.2 Download
You can find the latest version of this plugin in the EMSM GitHub repository.

2.3.3 Configuration
Since EMSM version 3.2.2-beta, this plugin requires no more configuration. The command line arguments allow you
to adjust the guard for each world.

2.3.4 Arguments
When invoked all worlds selected with the global EMSM commands -W or -w are checked.
--error-action {none, stop, restart}
Defines how the guard handles a world in trouble.
Note: Per default, all tests will be performed. If you dont want to run all tests, you can pass the tests, which should
be performed as command line arguments.
--test-status
Check if the world is online.
--test-log
Check if the logs contain an error.
--test-port
Check if the world is reachable.

2.3. emsm.plugins.guard

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

--output-format {console, text}


Defines the output format.
text is suitable for sending the guard output via email.
--output-only-new-warnings
If an error with the world has been detected in the previous run, the warning for this world will be suppressed.

2.3.5 Cron
This plugin is made for cron (therefore it does not print much):
# m h dom mon dow user command
# Runs the guard every 5 minutes for all worlds
root minecraft -W guard --output-only-new-warnings --output-format text
*/5 * *
*
*
# Runs the guard every 5 minutes for the world *foo*.
root minecraft -w foo guard --output-only-new-warnings --output-format text
*/5 * *
*
*

2.3.6 Changelog
3.0.0-beta
Removed configuration options that were dedicated to enable the guard for selected worlds.
The new guard simply monitors all worlds selected with the -W or -w argument.
3.2.2-beta
removed configuration options
added port check again
added different output formats

2.4 emsm.plugins.hellodolly
2.4.1 About
This plugins works as a tutorial. Its inspired by the wordpress plugin Hello Dolly.

2.4.2 Code and Download


You can find the latest version of hello_dolly on the EMSM GitHub GitHub repository.
#!/usr/bin/env python3
#
#
#
#
#
#
#
#

The MIT License (MIT)


Copyright (c) 2014-2015 Benedikt Schmitt <benedikt@benediktschmitt.de>
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

10

Chapter 2. Plugins

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

#
#
#
#
#
#
#
#
#
#
#
#
#

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.

"""
About
----This plugins works as a tutorial. It's inspired by the wordpress plugin
`Hello Dolly <https://wordpress.org/plugins/hello-dolly/>`_.
Code and Download
----------------You can find the latest version of *hello_dolly* on the EMSM GitHub
`GitHub repository <https://github.com/benediktschmitt/emsm/blob/master/plugins/plugins.py>`_.
..
By the way, this is a comment block in reST.
The next line is a little hack. Unfortunetly, sphinx does not find
"hellodolly.py" when this docstring is included with autodoc. So this does
not work:
.. literalinclude:: hellodolly.py
The next line is actually a small hack. When the documentation is
built, this module is included from
``EMSM_ROOT/docs/source/plugins/``, but the module is in
``EMSM_ROOT/plugins/```.
.. literalinclude:: ../../../emsm/plugins/hellodolly.py
Installation
-----------We want to distribute our plugin because we think it brings so much joy
to all players. So let's create a small package.
This is usually done with the :mod:`plugins.plugins` plugin:
.. code-block:: bash
$ foo@bar: ls
hellodolly.py ...
$ foo@bar: plugin.py --source hellodolly.py
$ foo@bar: ls
hellodolly.py hellodolly.tar.bz2 ...

2.4. emsm.plugins.hellodolly

11

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

The compressed package archive should now be in your working directory.


Usage
----.. code-block:: bash
$ foo@bar: # Will print only one row:
$ foo@bar: minecraft -W hellodolly
$ foo@bar: # Prints 5 rows or less, if the configuration value is smaller:
$ foo@bar: minecraft -W hellodolly --rows 5
Documentation
------------Acutally, EMSM uses sphinx *autodoc* feature to create the documentation for
the plugins. So what, you see here is the docstring of the ``hellodolly.py``
module.
"""

# Modules
# -----------------------------------------------# std
import os
import random
# third party
import termcolor
# local
import emsm
from emsm.core.base_plugin import BasePlugin

# Data
# -----------------------------------------------# This variable helps the EMSM to find the actual plugin class in this module.
PLUGIN = "HelloDolly"
# These are the well-known hello dolly lyrics.
LYRICS = """Hello, Dolly
Well, hello, Dolly
It's so nice to have you back where you belong
You're lookin' swell, Dolly
I can tell, Dolly
You're still glowin', you're still crowin'
You're still goin' strong
We feel the room swayin'
While the band's playin'
One of your old favourite songs from way back when
So, take her wrap, fellas
Find her an empty lap, fellas
Dolly'll never go away again
Hello, Dolly

12

Chapter 2. Plugins

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Well, hello, Dolly


It's so nice to have you back where you belong
You're lookin' swell, Dolly
I can tell, Dolly
You're still glowin', you're still crowin'
You're still goin' strong
We feel the room swayin'
While the band's playin'
One of your old favourite songs from way back when
Golly, gee, fellas
Find her a vacant knee, fellas
Dolly'll never go away
Dolly'll never go away
Dolly'll never go away again"""

# Classes
# -----------------------------------------------class HelloDolly(BasePlugin):
# We don't need to wait for other plugins, so we don't care
# about the init priority. If you want that your plugin is initialised
# earlier than others, make this value smaller.
INIT_PRIORITY = 0
# Also, we don't care about if the finish method of our plugin is called
# early or late. The *finish* method of plugins with a smaller
# *FINISH_PRIORITY* is called earlier.
FINISH_PRIORITY = 0
# At the moment, there is no direct url to the latest version of this
# plugin.
# In the future, the plugin manager could use this url to detect new
# versions of your plugin and will download them automatically.
DOWNLOAD_URL = None
# The last compatible version of the EMSM.
VERSION = "4.0.0-beta"
# The EMSM automatically uses the DESCRIPTION variable to set up the
# *--long-help* argument parser argument.
#
# We ususally use here the module's docstring. Note, that ``__doc__``
# does not interfere with the HelloDolly docstring ``HelloDolly.__doc__``
# since the HelloDolly class has no docstring.
DESCRIPTION = __doc__
def __init__(self, application, name):
"""
"""
# We need to init the BasePlugin. This is necessairy, so that we can
# safely access:
#
#
* self.conf()
#
* self.argparser()
#
* ...
BasePlugin.__init__(self, application, name)

2.4. emsm.plugins.hellodolly

13

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

# The configuration and argument parser are set up in own methods


# for readability.
self._setup_conf()
self._setup_argparser()
return None
def _setup_conf(self):
"""
Sets the configuration up.
"""
# Get the configuration dictionary for this plugin.
conf = self.conf()
#
#
#
#
#
#

This is an example of the hellodolly configuration section in the


main.conf configuration file:
[hellodolly]
max_rows = 5

self._max_rows = conf.getint("max_rows", 5)
conf["max_rows"] = str(self._max_rows)
return None
def _setup_argparser(self):
"""
Sets the argument parser up.
"""
# Get the plugin's argument parser.
parser = self.argparser()
parser.description = (
"Demonstrates the implementation of a plugin. Inspired by the "
"wordpress plugin \"Hello, Dolly\"."
)
parser.epilog = "https://github.com/benediktschmitt/emsm"
# Note, that we prefix the *dest* value, since all arguments share
# the same namespace.
parser.add_argument(
"--rows", "-r",
action = "store",
dest = "hellodolly_rows",
type = int,
default = 1,
metavar = "ROWS",
help = "The number of lines that will be printed."
)
return None
def _uninstall(self):
"""
If you created data not stored in ``data_dir()`` or used also the
*worlds.conf* or *server.conf* configuration files, you should ask the
user here, if he wants to remove these files and settings too.
Note the difference between ``_uninstall()`` and ``uninstall()``.
"""

14

Chapter 2. Plugins

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

# Your uninstallation stuff here


# ...
return None
def run(self, args):
"""
Writes lines of our lyrics into the chats of the selected worlds.
Parameters:
* args
Is a namespace that contains the parsed arguements.
"""
# Get the number of lines we want to print and make sure, that
# the number is not greater then the max_rows configuration value.
rows = args.hellodolly_rows
if rows > self._max_rows:
rows = self._max_rows
if rows < 0:
rows = 0
# Run hellodolly for each world, which has been selected with
# *-w* or *-W* per command line.
# We sort the worlds by their names, to process them in alphabetical
# order.
worlds = self.app().worlds().get_selected()
worlds.sort(key = lambda w: w.name())
for world in worlds:
self.be_poetic(world, rows)
return None
def get_lyrics(self, num_rows):
"""
Returns rows of the hello dolly lyrics.
Parameters:
* num_rows
The number of rows, that should be extracted from the
lyrics.
"""
global LYRICS
lyrics = LYRICS
# Get *num_rows* lines of the lyrics.
lyrics = lyrics.split("\n")
if num_rows > len(lyrics):
return lyrics
else:
a = random.randint(0, len(lyrics) - num_rows)
lyrics = lyrics[a:a+num_rows]
return lyrics
def be_poetic(self, world, num_rows):
"""
Writes the *lyrics* to the chat of all running, selected worlds.
"""
lyrics = self.get_lyrics(num_rows)

2.4. emsm.plugins.hellodolly

15

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

# We follow the inofficial EMSM style guide and print the


# world name in cyan.
print(termcolor.colored("{}:".format(world.name()), "cyan"))
if world.is_offline():
print("\t", termcolor.colored("error:", "red"), "world is offline")
else:
for row in lyrics:
world.send_command("say {}".format(row))
print("\t", "world has been visited")
return None
def finish(self):
"""
This method is always called, when the EMSM is about to finish.
It should be used for clean up or background stuff.
"""
return None

2.4.3 Installation
We want to distribute our plugin because we think it brings so much joy to all players. So lets create a small package.
This is usually done with the plugins.plugins plugin:
$ foo@bar: ls
hellodolly.py ...
$ foo@bar: plugin.py --source hellodolly.py
$ foo@bar: ls
hellodolly.py hellodolly.tar.bz2 ...

The compressed package archive should now be in your working directory.

2.4.4 Usage
$ foo@bar: # Will print only one row:
$ foo@bar: minecraft -W hellodolly
$ foo@bar: # Prints 5 rows or less, if the configuration value is smaller:
$ foo@bar: minecraft -W hellodolly --rows 5

2.4.5 Documentation
Acutally, EMSM uses sphinx autodoc feature to create the documentation for the plugins. So what, you see here is the
docstring of the hellodolly.py module.

2.5 emsm.plugins.initd
2.5.1 About
Works as interface between the linux initd service and the EMSM.

16

Chapter 2. Plugins

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

2.5.2 Download
You can find the latest version of this plugin in the EMSM GitHub repository.

2.5.3 Installation
You only have to create the init.d script /etc/init.d/minecraft:
1
2
3
4
5
6
7
8
9

#!/bin/bash
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:
# Short-Description:
### END INIT INFO

EMSM - extendable minecraft server manager


$remote_fs $syslog $network
$remote_fs $syslog $network
2 3 4 5
0 1 6
Starts and stops your minecraft worlds.

10
11
12

EMSM=`which minecraft`
PLUGIN=initd

13
14

test -x $EMSM || exit 0

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

case "$1" in
start)
$EMSM $PLUGIN --start
;;
stop)
$EMSM $PLUGIN --stop
;;
restart)
$EMSM $PLUGIN --restart
;;
status)
$EMSM $PLUGIN --status
;;
*)
echo "Usage: $0 {start|stop|restart|status}" >&2
exit 1
;;
esac
$ sudo chmod +x /etc/init.d/minecraft
$ sudo update-rc.d minecraft

2.5.4 Configuration
worlds.conf
[DEFAULT]
enable_initd = yes
[foo]
enable_initd = no

enable_initd
2.5. emsm.plugins.initd

17

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

If yes, the autostart/-stop is enabled.


If you want to enable init.d for all worlds, use the DEFAULT section.

2.5.5 Arguments
--start
Starts all worlds, where the enable_initd configuration value is true.
--stop
Stops all worlds, where the enable_initd configuration value is true. Note, that this will always force the stop of
the world, since the process is killed anyway during system shutdown.
--restart
Forces the restart of all worlds which has enable_initd enabled.

2.5.6 Exit code


The exit code is set to:
0 if no error occured.
2 if an error occured.

2.6 emsm.plugins.plugins
2.6.1 About
This is a package manager for EMSM plugins. Uninstall and install plugins with this plugin.
This plugin works only with valid packages and plugins that store its data in the dedicated paths.

2.6.2 Download
You can find the latest version of this plugin in the EMSM GitHub repository.

2.6.3 Arguments
--install ARCHIVE
Installs an new plugin from the archive. If a plugin with the same name already exists, the installation will fail.
--remove PLUGIN
Removes the plugin from the EMSM. Please make sure, that no other plugin depends on this one.
--list
Lists all loaded plugins.

18

Chapter 2. Plugins

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

2.6.4 Package structure


The archive that contains the plugin should have the following structure:
|- foo.tar.bz2
|- plugin.py
|- data
|- bar.txt
|- bar.csv
|- ...

During the installation, the path names will be changed to:


|- EMSM_ROOT
|- plugins
|- foo.py
<= plugin.py
|-plugins_data
|- foo
<= data
|- bar.txt
|- bar.csv
|- ...

2.6.5 Builder
This plugin comes with an EMSM independent building script for new plugins. This means, that you can call this
script without having the EMSM environment.
Arguments
--create TARGET
--source FILE
--data DIRECTORY
--help, -h
Example
Build the plugin foo, that comes with a data directory:
$ plugin.py --create build/foo --source dev/foo.py --data dev/foo_data
$ ls build
... foo.tar.bz2 ...

2.7 emsm.plugins.server
2.7.1 About
This plugin provides a user interface for the server wrapper. It can handle the server files and their configuration
parameters easily.

2.7. emsm.plugins.server

19

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

2.7.2 Download
You can find the latest version of this plugin in the EMSM GitHub repository.

2.7.3 Configuration
[server]
update_message = The server is going down for an update.
Come back soon.

update_message
Message sent to a world before stopping the world due to an server update.

2.7.4 Arguments
Note: Make sure to select the server via -s, --server.
--usage
Prints the names of the worlds, powered by a server.
--list
Prints the names of all server supported by the EMSM.
--update
Updates the server software.

2.8 emsm.plugins.worlds
2.8.1 About
This plugin provides a user interface for the server wrapper. It handles the server files and their configuration parameters easily.

2.8.2 Download
You can find the latest version of this plugin in the EMSM GitHub repository.

2.8.3 Configuration
[worlds]
default_log_start = 0
default_log_limit = 10
open_console_delay = 1
send_command_timeout = 10

default_log_start
Is the first line of the log, that is printed. Can be overwritten by a command line argument.
default_log_limit

20

Chapter 2. Plugins

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Is the default number of log lines, that is printed at once. This value can be overwritten by a command
line argument too.
open_console_delay
Time between printing the WARNING and opening the console.
send_command_timeout
Maximum time waited for the response of the minecraft server, if the --verbose-send command is
used.

2.8.4 Arguments
--address
Prints the binding (ip, port) of the world.
--configuration
Prints the section of the world in the worlds.conf.
--directory
Prints the directory path that contains the world.
--log
Prints the log.
--log-start LINE
The first line of the log that is printed. If -10 (with quotes!), the 10th last line will be the first line that is
printed.
--log-limit LINES
Limits the number of printed lines.
--pid
Prints the PID of the screen session that runs the server.
--status
Prints the status of the world (online or offline).
--send CMD
Sends the command to the world.
Note: Escaping commands with spaces
If you want to send a command like say Hello players!, you have to escape it.
minecraft -W worlds --send 'say Hello players!'

--verbose-send CMD
Sends the command to the server and prints the echo in the logfiles.
--console
Opens the server console.
--start
Starts the world
--stop
Warning: Stopping the world not using the dedicated commands, will not call the event dispatcher and
may cause bugs.

2.8. emsm.plugins.worlds

21

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Stops the world


--force-stop
Like stop, but kill the processes if the world is still online after the smooth stop.
--kill
Warning: Using this command can cause data loss.
Kills the process of the world.
--restart
Restarts the world. If the world is offline, the world will be started.
--force-restart
Like restart, but forces the stop of the world if necessairy.
--uninstall
Removes the world and its configuration.

2.8.5 Examples
# Start all worlds:
$ minecraft -W worlds --start
# Send a command to the server and print the console output:
$ minecraft -W worlds --verbose-send list
$ minecraft -W worlds --verbose-send '"say Use more TNT!"'
#
$
$
$
$

Print the
minecraft
minecraft
minecraft
minecraft

log of
-w foo
-w foo
-w foo
-w foo

the world *foo*:


worlds --log
worlds --log-start '-20'
worlds --log-limit 5
worlds --log-start '-50' --log-limit 10

# Open the console of a running world


$ minecraft -w bar worlds --console
...

2.9 What are EMSM plugins?


The EMSM plugins work as frontend for the EMSM and automate minecraft server tasks.

2.10 How to write a plugin


Its very easy to create your own plugin.
Read the hellodolly tutorial for a quick introduction.
If you want to know more and youre fit in Python, I suggest you read the source code of the EMSM for a full
overview. I guess this will not take more than 1h of your time. Simply start with the __init__.py module
and follow the calls.

22

Chapter 2. Plugins

CHAPTER 3

API

3.1 emsm.core.application
exception emsm.core.application.ApplicationException
Bases: Exception
Base class for all exceptions in this module.
exception emsm.core.application.WrongUserError(required_user)
Bases: emsm.core.application.ApplicationException
Raised if the EMSM is executed by the wrong user.
class emsm.core.application.Application(instance_dir)
Bases: object
This class manages the initialisation and the complete run process of the EMSM.
An EMSM application should be executed in a code structure similar to this one:
app = Application()
try:
app.setup()
app.run()
except Exception as err:
app.handle_exception()
raise
finally:
exit(app.finish())

argparser()
Returns the EMSM ArgumentParser, that is used internally.
conf()
Returns the used Configuration instance.
exit_code()
Returns the exit code of the application.
See also:
set_exit_code()
finish()
Performs some clean up and background stuff.
Returns exit_code()
23

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Note: Do not mix this method up with the emsm.core.plugins.PluginManager.finish()


method. These are not related.
See also:
run()
exit_code()
handle_exception()
Checks sys.exc_info() if there is currently an uncaught exception and logs it.
paths()
Returns the used Pathsystem instance.
plugins()
Returns the used PluginManager instance.
run()
Runs the plugins.
See also:
emsm.core.plugins.PluginManager.run()
emsm.core.plugins.PluginManager.finish()
server()
Returns the used ServerManager instance.
set_exit_code(code)
Sets the exit code to code. This is the exit code, that is used for the Python exit() function.
Raises
TypeError if code is not an int.
ValueError if code < 0.
See also:
exit_code()
exit()
setup()
Initialises all components of the EMSM.
This method will block, until the EMSM filelock could be acquired or the configuration timeout value is
reached.
worlds()
Returns the used WorldManager instance.

3.2 emsm.core.argparse_
This module contains the ArgumentParser class which wraps a Python argparse.ArgumentParser for the
EMSM.

24

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

class emsm.core.argparse_.LongHelpAction(option_strings,
dest===SUPPRESS==,
fault===SUPPRESS==)
Bases: argparse.Action

description=None,
de-

Prints the description using less (if available) and exists.


class emsm.core.argparse_.ArgumentParser(app)
Bases: object
Wraps an argparse.ArgumentParser instance.
This class handles the root EMSM argument parser. The root parser only has a few global EMSM commands
like -w, -s. Each plugin has its own subparser:
$ foo@bar: minecraft [emsm args] (plugin_name) [plugin args]

Example:
# Call the *worlds* plugin with the world *foo* as target.
$ foo@bar: minecraft -w foo worlds --status

argparser()
Returns the wrapped argparse.ArgumentParser instance.
args(cache=True)
Parses (if not yet done) the command line arguments and returns a namespace object that contains the
result.
Parameters cache (bool) If True, and the arguments have already been parsed, the result of
the previous parse is returned.
See also:
argparse.ArgumentParser.parse_args()
plugin_parser(plugin_name)
Returns the subparser for the plugin with the name plugin_name.
setup()
Adds the global EMSM arguments to the root argument parser.
This method has to be called, when the WorldManager and ServerManager have been loaded, since
we require the names of the available worlds and server.

3.3 emsm.core.base_plugin
class emsm.core.base_plugin.BasePlugin(app, name)
Bases: object
This is the base class for all plugins.
If you want to know, how to implement your own plugin, you should also take a look at the
plugins.hellodolly plugin.
DESCRIPTION =
This string is displayed when the --long-help argument is used.

3.3. emsm.core.base_plugin

25

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

DOWNLOAD_URL =
The plugin package can be downloaded from this url.
See also:
emsm.plugins.plugins package manager
FINISH_PRIORITY = 0
Integer with the finish priority of the plugin. A higher value results in a later call of the finish method.
HIDDEN = False
If True, the plugin has no argparser() and can therefore not be invoked from the command line.
INIT_PRIORITY = 0
Integer with the init priority of the plugin. A higher value results in a later initialisation.
VERSION = 0.0.0
The last version number of the EMSM version that worked correctly with that plugin.
app()
Returns the parent EMSM Application that owns this plugin.
argparser()
Returns the argparse.ArgumentParser that is used by this plugin.
If HIDDEN is True, None is returned, since the plugin has no argument parser.
See also:
emsm.core.argparse_.ArgumentParser.plugin_parser()
conf()
Returns a dictionary like object that contains the configuration of the plugin.
data_dir(create=True)
Returns the directory that contains all data created by the plugin to manage its EMSM job.
Parameters create (bool) If the directory does not exist, it will be created.
See also:
emsm.core.paths.Pathsystem.plugin_data_dir()
finish()
Called when the EMSM application is about to finish. This method can be used for background jobs or
clean up stuff.
Subclass:
You may override this method.
See also:
emsm.core.plugins.PluginManager.finish()
name()
Returns the name of the plugin.
plugin_uninstalled = <blinker.base.NamedSignal object at 0x7f8832dc55f8; plugin_uninstalled>
Signal, that is emitted, when a plugin has been uninstalled.

26

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

run(args)
The main method of the plugin. This method is called if the plugin has been invoked by the command line
arguments.
Params argparse.Namespace args is an argparse.Namespace instance that contains the values
of the parsed command line arguments.
Subclass:
You may override this method.
See also:
argparser()
emsm.core.argparse_.ArgumentParser.args()
emsm.core.plugins.PluginManager.run()
uninstall()
Called when the plugin should be uninstalled. This method is interactive and requires the user to confirm
if and which data should be removed.
The BasePlugin removes:
the plugin module (the .py file in plugins)
the plugin data directory
the plugin configuration
Subclass:
Subclasses should override the _uninstall() method.
Signals:
plugin_uninstalled
See also:
data_dir()
conf()
_uninstall()

3.4 emsm.core.conf
class emsm.core.conf.ConfigParser(path)
Bases: configparser.ConfigParser
Extends the standard Python configparser.ConfigParser by some useful methods.
Parameters path (str) The path to the configuration file. This file is used, when you call read()
or write().
path()
Returns the path of the configuration file.
read()
Reads the configuration from path().

3.4. emsm.core.conf

27

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

write()
Writes the configuration into path().
class emsm.core.conf.MainConfiguration(path)
Bases: emsm.core.conf.ConfigParser
Handles the main.conf configuration file.
This file includes the configuration for the EMSM Application and the plugins.
The EMSM owns the [emsm] section and each plugin has its own section with the plugin name.
[emsm]
user = minecraft
timeout = 0
screenrc =
[backups]
include_server = ...
# ...

class emsm.core.conf.ServerConfiguration(path)
Bases: emsm.core.conf.ConfigParser
Handles the server.conf configuration file, which allows the user to overwrite the default EMSM settings for a
server wrapper like the url or the start command.
See also:
emsm.core.server.BaseServerWrapper.conf()
class emsm.core.conf.WorldsConfiguration(path)
Bases: emsm.core.conf.ConfigParser
Handles the worlds.conf configuration file, which defines the names and settings of all worlds managed by the
EMSM.
See also:
emsm.core.worlds.WorldWrapper.conf()
class emsm.core.conf.Configuration(app)
Bases: object
Manages all configuration files of an EMSM application object.
See also:
emsm.core.application.Application.conf()
emsm.core.paths.Pathsystem.conf_dir()
main()
Returns the MainConfiguration.
read()
Reads all configration files.
server()
Returns the ServerConfiguration.

28

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

worlds()
Returns the WorldsConfiguration.
write()
Saves all configuration values.

3.5 emsm.core.license_

emsm.core.license_.LICENSE = The MIT License (MIT)\n\nCopyright (c) 2014 Benedikt Schmitt <benedikt@benedikts
The EMSM license

3.6 emsm.core.logging_
class emsm.core.logging_.Logger(app)
Bases: object
Sets the root logging.Logger up.
The EMSM logger queues all log records until the emsm.log can be acquired without side effects. This is the
case, when the Application acquired the file lock. The queued records are then pushed to the emsm.log.
The EMSM logging stategy requires, that each module uses its own logger instance:
>>> import logging
>>> log = logging.getLogger(__file__)

setup()
Opens the emsm.log and pushes all queued log recods to the log file.
Hint: This method requires that the Application aquired the file lock.

3.7 emsm.core.paths
class emsm.core.paths.Pathsystem(instance_dir)
Bases: object
Manages the paths to the different files and directories of the application.
The EMSM distinguishes two primary folders: The instance folder, where the worlds, server, configuration and
plugins of the user are placed. The instance folder can actually be considered to be the working directory of
the EMSM. On the other side is the EMSM installation directory. The emsm directory. This directory is usually
placed in Pythons third party library folder (site-packages) and contains the EMSM core application and the
core plugins.
1.emsm directory:
|- emsm
|- core
|- lib
|- ...
|- __init__.py
|- application.py
|- argparse_.py

3.5. emsm.core.license_

29

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

|- base_plugin.py
|- ...
|- plugins
|- __init__.py
|- backups.py
|- emsm.py
|- guard.py
|- ...
|- __init__.py

2.instance folder:
|- instance
# usually /opt/minecraft
|- conf
# the emsm configuration files
|- main.conf
|- server.conf
|- worlds.conf
|- plugins
# the user's plugins.
|- __init__.py
|- myawesomeplugin.py
|- ...
|- plugins_data
# data generated or needed by the plugins
|- backups
|- emsm
|- guard
|- ...
|- myawesomeplugin
|- ...
|- server
# the server executables
|- minecraft_server.jar
|- craftbukkit.jar
|- ...
|- worlds
# the data of the worlds (minecraft map, ...)
|- foo
|- server.properties
|- ...
|- bar
|- server.properties
|- ...
|- logs
|- emsm.log
|- emsm.log.1
|- ...
|- minecraft.py

conf()
Contains the configuration files of the EMSM. Not the configuration for the minecraft worlds. These are
still located in the world folder.
The directory contains the main.conf, server.conf and worlds.conf file.
The directory is located in the instance folder.
create()
Creates the folders used by the EMSM Application.
This method should only be called, after the EMSM downgraded its priviliges.
emsm()

30

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Returns the path to the emsm installation directory.


site-packages directory.

This folder is usually located in Pythons

emsm_core()
Returns the path to the emsm.core directory.
emsm_plugins()
Returns the path to the emsm.plugins directory. The directory contains the core plugins like worlds, server,
backups, ...
instance()
The instance folder contains all data generated by the EMSM application and the minecraft worlds.
logs()
Contains the EMSM log files.
Note, that this is NOT the log directory of the minecraft server.
plugin_data(plugin_name)
This directory contains all data of the plugin with the name plugin_name.
The directory is a subfolder of plugins_data().
plugins()
Contains all user plugins and plugin packages.
The directory is located in the instance folder.
See also:
emsm_plugins()
plugins_data()
The directory that contains the data generated or used by all plugins.
The directory is located in the instance folder.
See also:
plugin_data()
server()
This directory contains all server executables specified in the server.conf configuration file.
The directory is located in the instance folder.
See also:
server_()
server_(server_name)
This directory contains the server software for the server with the name server_name.
The directory is located in the server() folder.
Todo
Try to find better names for server and server_. They are hard to distinguish.
world(world_name)
This directory contains the data generated by the minecraft server which powers the world world_name. It
contains among others those files:
server.properties
ops.json
3.7. emsm.core.paths

31

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

whitelist.json
Furthermore, it is a child of worlds().
worlds()
Contains for each world in worlds.conf one folder that contains the data generated by the minecraft
server.
The directory is located in the instance folder.
See also:
world()

3.8 emsm.core.plugins
exception emsm.core.plugins.PluginException
Bases: Exception
Base class for all exceptions in this module.
exception emsm.core.plugins.PluginImplementationError(plugin, msg)
Bases: emsm.core.plugins.PluginException
Raised if a plugin is not correct implemented.
exception emsm.core.plugins.PluginOutdatedError(plugin)
Bases: emsm.core.plugins.PluginException
Raised if the version of the plugin is not compatible with the EMSM version.
See also:
http://semver.org/
class emsm.core.plugins.PluginManager(app)
Bases: object
Loads and manages all plugins.
If you want to write a plugin and search for the docs, take a look at the hellodolly plugin.
See also:
BasePlugin
finish()
Calls finish() for each loaded plugin.
get_all_plugins()
Returns all currently loaded plugin instances.
See also:
get_plugin_names()
get_plugin()
get_module(plugin_name)
Returns the Python module object that contains the plugin with the name plugin_name or None if there is
no plugin with that name.
32

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

get_plugin(plugin_name)
Returns the instance of the plugin with the name plugin_name that is currently loaded and used by the
EMSM.
get_plugin_names()
Returns the names of all loaded plugins.
get_plugin_type(plugin_name)
Returns the plugin class for the plugin with the name plugin_name or None, if there is no plugin with that
name.
import_from_directory(directory)
Imports all Python modules in the directory.
Files that do not contain a valid EMSM plugin, are ignored. You can check the log files to see which
plugins have been ignored.
See also:
import_plugin()
import_plugin(path)
Loads the plugin located at path.
Note: The path is no longer added to sys.path (EMSM Vers. >= 3).
Raises
PluginOutdatedError when the plugin is outdated.
PluginImplementationError when the plugin is not correct implemented.
See also:
_plugin_is_outdated()
init_plugins()
Creates a plugin instance for each loaded plugin class.
When you call this method multiple times, only plugins that have not been initialised already, will be
initialised.
plugin_is_available(plugin_name)
Returns True, if the plugin with the name plugin_name is available.
remove_plugin(plugin_name, call_finish=False)
Unloads the plugin with the name plugin_name.
Parameters
plugin_name (str) The name of the plugin that should be unloaded.
call_finish (bool) If true, the finish() method of the plugin is called, before it
is unloaded.
run()
Calls run() of the plugin that has been selected by the command line arguments.
See also:
emsm.core.argparse_.ArgumentParser.args()
3.8. emsm.core.plugins

33

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

setup()
Imports all plugins from the applications plugin directory.
See also:
emsm.core.paths.Pathsystem.plugins()
emsm.core.paths.Pathsystem.emsm_plugins()

3.9 emsm.core.server
exception emsm.core.server.ServerError
Bases: Exception
Base class for all exceptions in this module.
exception emsm.core.server.ServerInstallationFailure(server, msg=None)
Bases: emsm.core.server.ServerError
Raised if a server installation failed.
exception emsm.core.server.ServerStatusError(server, status, msg=)
Bases: emsm.core.server.ServerError
Raised if the server should be online/offline for an action but is offline/online.
exception emsm.core.server.ServerIsOnlineError(server, msg=)
Bases: emsm.core.server.ServerStatusError
Raised if the server is online but should be offline.
exception emsm.core.server.ServerIsOfflineError(server, msg=)
Bases: emsm.core.server.ServerStatusError
Raised if the server is offline but should be online.
class emsm.core.server.BaseServerWrapper(app)
Bases: object
Wraps a minecraft server (executable), NOT a world.
The BaseServerWrapper is initialized using the options in the server.conf configuration file.
Parameters app (emsm.core.application.Application) The parent EMSM application
conf()
Returns the configuration section in the server.conf configuration file.
default_start_cmd()
ABSTRACT
Returns the bash command string, that must be executed, to start the server.
If there are paths in the returned command, they must be absolute.
default_url()
ABSTRACT
The URL where the server executable can be downloaded from.
directory()
Absolute path to the directory which contains all server software.

34

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

exe_path()
ABSTRACT
Absolute path to the server executable. This file is usually located in directory().
install()
ABSTRACT
Installs the server by downloading it to server(). If the server is already installed, nothing should
happen.
This method is called during the EMSM start phase if is_installed() returns False.
Raises ServerInstallationFailure
when the installation failed.
is_installed()
True if the executable has been downloaded and exists, otherwise False.
Per default, this method only checks if the directory() is empty or not. It can be overridden for a
more detailed check.
is_online()
Returns True if at least one world is currently running with this server.
log_error_re()
ABSTRACT
Returns a regex, that matches every line with a severe (critical) error. A severe error means, that the server
does not run correct and needs to be restarted.
log_path(self )
ABSTRACT
Returns the path of the server log file of a world.
If a relative path is returned, the base path is the world directory.
log_start_re()
ABSTRACT
Returns a regex, that matches the first line in the log file, after a server restart.
classmethod name()
ABSTRACT
The unique name of the server.
Example:
"vanilla 1.8"
reinstall()
Tries to reinstall the server. If the reinstallation fails, the old server() is restored and everything is like
before.
Raises
ServerInstallationFailure
when the installation failed.
ServerIsOnlineError
when a world powered by this server software is online.

3.9. emsm.core.server

35

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

start_cmd()
Returns the value for start_command in conf() if available and the default_start_cmd() otherwise.
translate_command(cmd)
ABSTRACT
Translates the vanilla server command cmd to a command with the same meaning, but which can be
understood by the server.
Example:
>>> # A BungeeCoord wrapper would do this:
>>> bungeecord.translate_command("stop")
"end"
>>> bungeecord.translate_command("say Hello World!")
"alert Hello World!"

url()
Returns the url in conf(), if available. Otherwise the value of default_url().
world_address(world)
ABSTRACT
Returns the address (ip, port) which is binded by the world. (None, None) should be returned, if the
binding can not be retrieved.
If the server is binded to all ip addresses, return the emtpy string "" for the ip address.
The port should be returned as integer. If it can not be retrieved, return None.
class emsm.core.server.ServerManager(app)
Bases: object
Manages all server wrappers, owned by an EMSM application.
The ServerManager helps to avoid double instances of the same server wrapper.
add(server_class)
Makes the server_class visible to this manager. The class must implement all abstract methods of
BaseServerWrapper or unexpected errors may occure.
Raises
TypeError if server_class does not inherit BaseServerWrapper
ValueError if another wrapper with the name() of server_class has already been
registered.
get(servername)
Returns the ServerWrapper with the name servername and None, if there is not such a server.
get_all()
Returns a list with all loaded ServerWrapper.
get_by_pred(pred=None)
Almost equal to:
>>> filter(pred, ServerManager.get_all())
...

get_names()
Returns a list with the names of all server.

36

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

get_selected()
Returns all server that have been selected per command line argument.

3.10 emsm.core.version
emsm.core.version.VERSION = 4.0.13-beta
The version of the EMSM.
Take a look at http://semver.org for more information.

3.11 emsm.core.worlds
exception emsm.core.worlds.WorldError
Bases: Exception
Base class for all other exceptions in this module.
exception emsm.core.worlds.WorldStatusError(world, is_online)
Bases: emsm.core.worlds.WorldError
Raised, if a task can not be done because of the current status of the world (online or not online).
exception emsm.core.worlds.WorldIsOnlineError(world)
Bases: emsm.core.worlds.WorldStatusError
Raised if a world is online but should be offline.
exception emsm.core.worlds.WorldIsOfflineError(world)
Bases: emsm.core.worlds.WorldStatusError
Raised if a world is offline but should be online.
exception emsm.core.worlds.WorldStartFailed(world)
Bases: emsm.core.worlds.WorldError
Raised if the world start failed.
exception emsm.core.worlds.WorldStopFailed(world)
Bases: emsm.core.worlds.WorldError
Raised if the world stop failed.
exception emsm.core.worlds.WorldCommandTimeout(world=)
Bases: emsm.core.worlds.WorldError
Raised, when the server did not react in x seconds.
class emsm.core.worlds.WorldWrapper(app, name)
Bases: object
Provides methods to handle a minecraft world like start(), stop(), restart(), ...
The WorldWrapper is initialised using the configuration options in the section with the name name in the
server.conf configuration file.
address()
Returns the binding (ip, port) of the world. If those values can not be retrieved, (None, None) is
returned.

3.10. emsm.core.version

37

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

conf()
The configuration section of this world.
See also:
WorldsConfiguration
directory()
Returns the directory that contains all world data generated by the minecraft server.
If the world is run by the mojang minecraft server, this directory contains the server.properties,
whitelist.json, ... files.
install()
Creates the directory of the world.
See also:
meth:directory
is_installed()
Returns True if the directory() of the world exists, otherwise False.
See also:
directory()
install()
uninstall()
is_offline()
Returns True if the world is currently not running.
is_online()
Returns True if the world is currently running.
kill_processes()
Kills all processes with a pid in pids().
Signals:
world_about_to_stop
world_stopped
world_stop_failed
Raises WorldStopFailed if the process could not be killed.
See also:
pids()
latest_log()
Returns the log of the world since the last start. If the logfile does not exist, an empty string will be
returned.

38

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

name()
The name of the world.
This is the name of the configuration section in worlds.conf and the folder name in the worlds
directory.
open_console()
Opens all screen sessions whichs pid is in pids().
Raises WorldIsOfflineError if the world is offline.
pids()
Returns a list with the pids of the screen sessions with the name screen_name().
restart(force_restart=False, stop_args=None)
Restarts the server.
Parameters
force_restart (bool) Forces
kill_processes() if necessairy.

the

stop

of

the

server

by

calling

stop_args (dict) If provided, these values are passed to stop().


Signals:
world_about_to_stop
world_stopped
world_stop_failed
world_about_to_start
world_started
world_start_failed
Raises
WorldStopFailed if the world could not be stopped.
WorldStartFailed if the world could not be restarted.
See also:
stop()
start()
screen_name()
Returns the name of the screen sessions that run the server of this world.
send_command(server_cmd)
Sends the given command to all screen sessions with the worlds screen name.
Raises WorldIsOfflineError if the world is offline.
Warning: There is no guarantee, that the server reacted to the command.
send_command_get_output(server_cmd, timeout=10, poll_intervall=0.2)
Like send_commmand() but checks every poll_intervall seconds, if content has been added to the logfile
and returns the change. If no change could be detected after timeout seconds, an error will be raised.

3.11. emsm.core.worlds

39

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Raises
WorldIsOfflineError if the world is offline.
WorldCommandTimeout if the world did not react within timeout seconds.
server()
The ServerWrapper for the server that runs this world.
set_server(server)
Changes the server that runs this world. The world has to be offline.
Parameters server (emsm.core.server.ServerWrapper) The new server
:raises WorldIsOnlineError* if the world is online.
start(wait_check_time=0.1)
Starts the world if the world is offline. If the world is already online, nothing happens.
Signals:
world_about_to_start
world_started
world_start_failed
Parameters wait_check_time (float) Time waited, before checking if the server actually
started.
Raises WorldStartFailed if the world could not be started.
stop(force_stop=False, message=None, delay=None, timeout=None)
Stops the server.
Parameters
message (str) Send to the world before the stop() command is executed.
delay (float) Time in seconds that is waited between seding the message and executing
the :methstop command.
timeout (float) Maximum time in seconds waited for the server stop after executing
the stop() command.
force_stop (bool) If true
kill_processes() is called.

and

the

server

could

not

be

stopped,

Signals:
world_about_to_stop
world_stopped
world_stop_failed
Raises WorldStopFailed if the world could not be stopped.
See also:
kill_processes()
is_offline()

40

Chapter 3. API

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

uninstall()
Stops the world and removes the world directory.
See also:
kill_processes()
directory()
world_about_to_start = <blinker.base.NamedSignal object at 0x7f88328864e0; world_about_to_start>
Signal, that is emitted when a world is about to start.
world_about_to_stop = <blinker.base.NamedSignal object at 0x7f8832886588; world_about_to_stop>
Signal, that is emitted when a world is about to be stopped.
world_start_failed = <blinker.base.NamedSignal object at 0x7f8832886550; world_start_failed>
Signal, that is emitted when a world could not be started.
world_started = <blinker.base.NamedSignal object at 0x7f8832886518; world_started>
Signal, that is emitted when a world has been started.
world_stop_failed = <blinker.base.NamedSignal object at 0x7f88328865f8; world_stop_failed>
Signal, that is emitted when a world could not be stopped.
world_stopped = <blinker.base.NamedSignal object at 0x7f88328865c0; world_stopped>
Signal, that is emitted when a world has been stopped.
world_uninstalled = <blinker.base.NamedSignal object at 0x7f88328864a8; world_uninstalled>
Signal, that is emitted when a world has been uninstalled.
worldpath_to_ospath(rel_path)
Converts rel_path, that is relative to the root directory of the minecraft world, into the absolute path of the
operating system.
Example:
>>> # I assume the EMSM root is: "/home/minecraft"
>>> foo.name()
"foo"
>>> foo.worldpath_to_ospath("server.properties")
"/opt/minecraft/worlds/foo/server.properties"

See also:
directory()
class emsm.core.worlds.WorldManager(app)
Bases: object
Works as a container for the WorldWrapper instances.
get(worldname)
Returns the WorldWrapper for the world with the name worldname or None if there is no world with
that name.
get_all()
Returns a list with all loaded worlds.
get_by_pred(pred=None)
Filters the worlds using the predicate pred.
Example:

3.11. emsm.core.worlds

41

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

>>> # All running worlds


>>> wm.get_by_pred(lambda w: w.is_online())
...

See also:
get_all()
get_names()
Returns a list with the names of all worlds.
get_selected()
Returns all worlds that have been selected per command line argument.
See also:
emsm.core.argparse_.ArgumentParser.args()
load_worlds()
Loads all worlds declared in the worlds.conf configuration file.
See also:
WorldsConfiguration
If you want to know, how the EMSM works, you are probably faster by reading the source code than this API documentation. The code is written to be read by other persons and quite easy to understand. Since the EMSM does not
use threads, you can simply follow the function calls, starting in __init__.py. I guess it wont last longer than 1.5
hours to read and understand how the EMSM works.

3.12 About the depencies


The EMSM depends on some tools and Python packages.
One of them (the most important) is screen, which is used to run the minecraft worlds in the background.
We also depend on some Python packages, which are all available via PyPi.

42

Chapter 3. API

CHAPTER 4

Changelog

This log contains only the changes beginning with version 3.1.1-beta.
4.0.13-beta
fixed The start command option nogui of the forge server
4.0.12-beta
fixed issue #35
fixed The start command option nogui of the vanilla server
4.0.5-beta
The server executables are now always placed in a subdirectory of INSTANCE_ROOT/server/.
removed emsm.core.server.BaseServerWrapper.server()
added emsm.core.server.BaseServerWrapper.directory()
added emsm.core.server.BaseServerWrapper.exe_path()
The start_command in the server.conf accepts due to the changes above now these placeholders:
* {server_exe} Points to the server executable
* {server_dir} Points to the directory which contains all server software.
added* emsm.core.paths.Pathsystem.server_()
4.0.0-beta
changed The EMSM is now a valid Python package available via PyPi.
cleaned the documentation
EMSM upgrade from version 3 beta:
1. Install the EMSM package
$ sudo pip3 install emsm

2. Remove obsolete folders and files:


$
$
$
$

rm
rm
rm
rm

README.md
LICENSE.md
minecraft.py
.gitignore

43

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

$ rm -rf .git/
$ rm -rf docs/
$ rm -rf emsm
# You probably want to keep your own plugins. So modify the
# command to delete only the EMSM plugins (worlds, server, ...).
$ rm -r plugins/*

3. Create the minecraft.py file:


#!/usr/bin/env python3
import emsm
# Make sure, the instance folder is correct.
emsm.run(instance_dir = "/opt/minecraft")
$ chmod +x /opt/minecraft/minecraft.py
$ chown minecraft:minecraft /opt/minecraft/minecraft.py

3.1.1-beta
added emsm.core.server.BaseServerWrapper.world_address() method
added emsm.core.server.BaseServerWrapper.log_error_re() method
added termcolor as Python requirement
added colorama as Python requirement
added pyyaml as Python requirement
added wait_check_time parameter to emsm.core.worlds.WorldWrapper.start()
updated the console output: the output is now sorted, colored and consistent
updated emsm.plugins.guard plugin (big rework, take a look)

44

Chapter 4. Changelog

CHAPTER 5

Contribute

This project needs your help! Please help to improve this application and fork the repository on GitHub.

5.1 Bug reports


When you found a bug, please create a bug report.
If you know how to fix the bug, youre welcome to send a pull request.

5.2 Code
If you like the EMSM and want to contribute to the code, then do it :)
Note, that commits should never go directly to the master branch.

5.3 Plugins
You wrote a new plugin and want to share it? Great! Write me about it on GitHub and I will add it to the plugins
list.
To simplify the usage by other users, you could prepare your plugin:
1. Choose a short and unique name for your plugin.
2. Create a plugin package, that contains the source file and data, which comes with your plugin.
3. Add a small reST docstring to your plugin. If you dont know how to do this, you can take a look at the source
code of some other plugins. Its quite easy.
The documentation should contain at least those sections:
About (What does your plugin?)
Download URL
45

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

Configuration
Arguments

5.4 Spelling Mistakes


I guess the source code and this documentation contain a lot of spelling mistakes. Please help to reduce them.

46

Chapter 5. Contribute

CHAPTER 6

License

6.1 Source Code


Beginning with version 2.0.1-beta, the EMSM is published under the MIT license:
The MIT License (MIT)
Copyright (c) 2014 Benedikt Schmitt <benedikt@benediktschmitt.de>
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.

Earlier versions have been released under the GNU GPLv3.

6.2 Documentation
The documentation is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

47

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

48

Chapter 6. License

CHAPTER 7

About

Source code: https://github.com/benediktschmitt/emsm

7.1 Sources
Octocat: https://github.com/logos

49

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

50

Chapter 7. About

CHAPTER 8

Indices and tables

genindex
modindex
search

51

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

52

Chapter 8. Indices and tables

CHAPTER 9

What is the EMSM ?

The Extendable Minecraft Server Manager (EMSM) is a minecraft server wrapper, that is able to handle multiple
minecraft worlds and server versions.
The EMSM itself provides only a simple but sufficient API to manage the worlds. The rest of the work is done by the
plugins. This makes the application easy to extend and maintain.
And the best thing: We support many server:
vanilla (mojang server) beginning with version 1.2
bungeecord
minecraft forge
spigot

53

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

54

Chapter 9. What is the EMSM ?

CHAPTER 10

Why should you use the EMSM?

Python powered
Small and readable code base, therefore easy to maintain.
Open Source
Licensed under the MIT License.
Portable
Needs only Python, screen and java to run and should work on all Linux systems.
Cron-Save
The EMSM makes sure, that only one instance of the application runs to the same time.
InitD
Use the initd plugin to benefit from the init.d service.
Simple Configuration
Only three simple configuration files with the simple .ini syntax.
Backup ready
Create and manage multiple versions of your worlds with the backup manager.
Multiple worlds and server
This application has been written to administrate and run multiple worlds and server versions to the same time.
Beautiful output
The EMSM output is colored, so that you only need one view to get the most important information.
Guarded worlds
The guard helps you to monitor the worlds and to react on server issues automatically.
Fast learning curve
Use the --help or --long-help argument if you dont know how to use a plugin.
Online Documentation
You dont come to grips with the configuration? Take a look at this online documentation.
Easy to extend
Extend the EMSM with a simple plugin and benefit from Pythons great standard library.

55

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

56

Chapter 10. Why should you use the EMSM?

CHAPTER 11

Collaboration

Fork this project on GitHub.

57

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

58

Chapter 11. Collaboration

Python Module Index

e
emsm.core.application, 23
emsm.core.argparse_, 24
emsm.core.base_plugin, 25
emsm.core.conf, 27
emsm.core.license_, 29
emsm.core.logging_, 29
emsm.core.paths, 29
emsm.core.plugins, 32
emsm.core.server, 34
emsm.core.version, 37
emsm.core.worlds, 37
emsm.plugins.backups, 7
emsm.plugins.emsm, 8
emsm.plugins.guard, 9
emsm.plugins.hellodolly, 10
emsm.plugins.initd, 16
emsm.plugins.plugins, 18
emsm.plugins.server, 19
emsm.plugins.worlds, 20

59

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

60

Python Module Index

Index

Symbols
address
command line option, 21
check-update
command line option, 9
configuration
command line option, 21
console
command line option, 21
create
command line option, 8
create TARGET
command line option, 19
data DIRECTORY
command line option, 19
directory
command line option, 21
error-action {none, stop, restart}
command line option, 9
force-restart
command line option, 22
force-stop
command line option, 22
help, -h
command line option, 19
install ARCHIVE
command line option, 18
kill
command line option, 22
license
command line option, 9
list
command line option, 8, 18, 20
log
command line option, 21
log-limit LINES
command line option, 21
log-start LINE
command line option, 21
output-format {console, text}

command line option, 9


output-only-new-warnings
command line option, 10
pid
command line option, 21
remove PLUGIN
command line option, 18
restart
command line option, 18, 22
restore PATH
command line option, 8
restore-latest
command line option, 8
restore-menu
command line option, 8
send CMD
command line option, 21
source FILE
command line option, 19
start
command line option, 18, 21
status
command line option, 21
stop
command line option, 18, 21
test-log
command line option, 9
test-port
command line option, 9
test-status
command line option, 9
uninstall
command line option, 22
update
command line option, 20
usage
command line option, 20
verbose-send CMD
command line option, 21
version
command line option, 9
61

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

A
add() (emsm.core.server.ServerManager method), 36
address() (emsm.core.worlds.WorldWrapper method), 37
app() (emsm.core.base_plugin.BasePlugin method), 26
Application (class in emsm.core.application), 23
ApplicationException, 23
argparser() (emsm.core.application.Application method),
23
argparser()
(emsm.core.argparse_.ArgumentParser
method), 25
argparser() (emsm.core.base_plugin.BasePlugin method),
26
args() (emsm.core.argparse_.ArgumentParser method),
25
ArgumentParser (class in emsm.core.argparse_), 25

B
BasePlugin (class in emsm.core.base_plugin), 25
BaseServerWrapper (class in emsm.core.server), 34

C
command line option
address, 21
check-update, 9
configuration, 21
console, 21
create, 8
create TARGET, 19
data DIRECTORY, 19
directory, 21
error-action {none, stop, restart}, 9
force-restart, 22
force-stop, 22
help, -h, 19
install ARCHIVE, 18
kill, 22
license, 9
list, 8, 18, 20
log, 21
log-limit LINES, 21
log-start LINE, 21
output-format {console, text}, 9
output-only-new-warnings, 10
pid, 21
remove PLUGIN, 18
restart, 18, 22
restore PATH, 8
restore-latest, 8
restore-menu, 8
send CMD, 21
source FILE, 19
start, 18, 21
status, 21

62

stop, 18, 21
test-log, 9
test-port, 9
test-status, 9
uninstall, 22
update, 20
usage, 20
verbose-send CMD, 21
version, 9
conf() (emsm.core.application.Application method), 23
conf() (emsm.core.base_plugin.BasePlugin method), 26
conf() (emsm.core.paths.Pathsystem method), 30
conf() (emsm.core.server.BaseServerWrapper method),
34
conf() (emsm.core.worlds.WorldWrapper method), 37
ConfigParser (class in emsm.core.conf), 27
Configuration (class in emsm.core.conf), 28
create() (emsm.core.paths.Pathsystem method), 30

D
data_dir() (emsm.core.base_plugin.BasePlugin method),
26
default_start_cmd() (emsm.core.server.BaseServerWrapper
method), 34
default_url()
(emsm.core.server.BaseServerWrapper
method), 34
DESCRIPTION (emsm.core.base_plugin.BasePlugin attribute), 25
directory()
(emsm.core.server.BaseServerWrapper
method), 34
directory() (emsm.core.worlds.WorldWrapper method),
38
DOWNLOAD_URL (emsm.core.base_plugin.BasePlugin
attribute), 25

E
emsm() (emsm.core.paths.Pathsystem method), 30
emsm.core.application (module), 23
emsm.core.argparse_ (module), 24
emsm.core.base_plugin (module), 25
emsm.core.conf (module), 27
emsm.core.license_ (module), 29
emsm.core.logging_ (module), 29
emsm.core.paths (module), 29
emsm.core.plugins (module), 32
emsm.core.server (module), 34
emsm.core.version (module), 37
emsm.core.worlds (module), 37
emsm.plugins.backups (module), 7
emsm.plugins.emsm (module), 8
emsm.plugins.guard (module), 9
emsm.plugins.hellodolly (module), 10
emsm.plugins.initd (module), 16
emsm.plugins.plugins (module), 18
Index

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

emsm.plugins.server (module), 19
emsm.plugins.worlds (module), 20
emsm_core() (emsm.core.paths.Pathsystem method), 31
emsm_plugins() (emsm.core.paths.Pathsystem method),
31
exe_path()
(emsm.core.server.BaseServerWrapper
method), 34
exit_code() (emsm.core.application.Application method),
23

import_plugin()
(emsm.core.plugins.PluginManager
method), 33
init_plugins()
(emsm.core.plugins.PluginManager
method), 33
INIT_PRIORITY (emsm.core.base_plugin.BasePlugin
attribute), 26
install() (emsm.core.server.BaseServerWrapper method),
35
install() (emsm.core.worlds.WorldWrapper method), 38
instance() (emsm.core.paths.Pathsystem method), 31
F
is_installed()
(emsm.core.server.BaseServerWrapper
method), 35
finish() (emsm.core.application.Application method), 23
(emsm.core.worlds.WorldWrapper
finish() (emsm.core.base_plugin.BasePlugin method), 26 is_installed()
method), 38
finish() (emsm.core.plugins.PluginManager method), 32
FINISH_PRIORITY (emsm.core.base_plugin.BasePlugin is_offline() (emsm.core.worlds.WorldWrapper method),
38
attribute), 26
is_online()
(emsm.core.server.BaseServerWrapper
G
method), 35
is_online() (emsm.core.worlds.WorldWrapper method),
get() (emsm.core.server.ServerManager method), 36
38
get() (emsm.core.worlds.WorldManager method), 41
get_all() (emsm.core.server.ServerManager method), 36
K
get_all() (emsm.core.worlds.WorldManager method), 41
(emsm.core.worlds.WorldWrapper
get_all_plugins()
(emsm.core.plugins.PluginManager kill_processes()
method), 38
method), 32
get_by_pred()
(emsm.core.server.ServerManager
L
method), 36
get_by_pred()
(emsm.core.worlds.WorldManager latest_log() (emsm.core.worlds.WorldWrapper method),
38
method), 41
get_module()
(emsm.core.plugins.PluginManager LICENSE (in module emsm.core.license_), 29
load_worlds()
(emsm.core.worlds.WorldManager
method), 32
method), 42
get_names() (emsm.core.server.ServerManager method),
log_error_re()
(emsm.core.server.BaseServerWrapper
36
method), 35
get_names() (emsm.core.worlds.WorldManager method),
log_path()
(emsm.core.server.BaseServerWrapper
42
method), 35
get_plugin()
(emsm.core.plugins.PluginManager
log_start_re()
(emsm.core.server.BaseServerWrapper
method), 32
method), 35
get_plugin_names() (emsm.core.plugins.PluginManager
Logger (class in emsm.core.logging_), 29
method), 33
get_plugin_type()
(emsm.core.plugins.PluginManager logs() (emsm.core.paths.Pathsystem method), 31
LongHelpAction (class in emsm.core.argparse_), 24
method), 33
get_selected()
(emsm.core.server.ServerManager
M
method), 36
get_selected()
(emsm.core.worlds.WorldManager main() (emsm.core.conf.Configuration method), 28
MainConfiguration (class in emsm.core.conf), 28
method), 42

handle_exception() (emsm.core.application.Application name() (emsm.core.base_plugin.BasePlugin method), 26


name() (emsm.core.server.BaseServerWrapper class
method), 24
method), 35
HIDDEN (emsm.core.base_plugin.BasePlugin attribute),
name() (emsm.core.worlds.WorldWrapper method), 38
26

import_from_directory() (emsm.core.plugins.PluginManageropen_console()
(emsm.core.worlds.WorldWrapper
method), 33
method), 39
Index

63

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

set_server() (emsm.core.worlds.WorldWrapper method),


40
path() (emsm.core.conf.ConfigParser method), 27
setup()
(emsm.core.application.Application
method), 24
paths() (emsm.core.application.Application method), 24
setup()
(emsm.core.argparse_.ArgumentParser
method),
Pathsystem (class in emsm.core.paths), 29
25
pids() (emsm.core.worlds.WorldWrapper method), 39
plugin_data() (emsm.core.paths.Pathsystem method), 31 setup() (emsm.core.logging_.Logger method), 29
plugin_is_available() (emsm.core.plugins.PluginManager setup() (emsm.core.plugins.PluginManager method), 34
start() (emsm.core.worlds.WorldWrapper method), 40
method), 33
(emsm.core.server.BaseServerWrapper
plugin_parser() (emsm.core.argparse_.ArgumentParser start_cmd()
method),
35
method), 25
stop()
(emsm.core.worlds.WorldWrapper
method), 40
plugin_uninstalled (emsm.core.base_plugin.BasePlugin
attribute), 26
T
PluginException, 32
translate_command() (emsm.core.server.BaseServerWrapper
PluginImplementationError, 32
method), 36
PluginManager (class in emsm.core.plugins), 32
PluginOutdatedError, 32
plugins() (emsm.core.application.Application method), U
24
uninstall() (emsm.core.base_plugin.BasePlugin method),
plugins() (emsm.core.paths.Pathsystem method), 31
27
plugins_data() (emsm.core.paths.Pathsystem method), 31 uninstall() (emsm.core.worlds.WorldWrapper method),
40
R
url() (emsm.core.server.BaseServerWrapper method), 36
read() (emsm.core.conf.ConfigParser method), 27
V
read() (emsm.core.conf.Configuration method), 28
reinstall()
(emsm.core.server.BaseServerWrapper VERSION
(emsm.core.base_plugin.BasePlugin
atmethod), 35
tribute), 26
remove_plugin()
(emsm.core.plugins.PluginManager VERSION (in module emsm.core.version), 37
method), 33
restart() (emsm.core.worlds.WorldWrapper method), 39
W
run() (emsm.core.application.Application method), 24
world() (emsm.core.paths.Pathsystem method), 31
run() (emsm.core.base_plugin.BasePlugin method), 26
world_about_to_start (emsm.core.worlds.WorldWrapper
run() (emsm.core.plugins.PluginManager method), 33
attribute), 41
world_about_to_stop (emsm.core.worlds.WorldWrapper
attribute), 41
screen_name()
(emsm.core.worlds.WorldWrapper world_address() (emsm.core.server.BaseServerWrapper
method), 39
method), 36
send_command()
(emsm.core.worlds.WorldWrapper world_start_failed (emsm.core.worlds.WorldWrapper atmethod), 39
tribute), 41
send_command_get_output()
world_started (emsm.core.worlds.WorldWrapper at(emsm.core.worlds.WorldWrapper method), 39
tribute), 41
server() (emsm.core.application.Application method), 24 world_stop_failed (emsm.core.worlds.WorldWrapper atserver() (emsm.core.conf.Configuration method), 28
tribute), 41
server() (emsm.core.paths.Pathsystem method), 31
world_stopped
(emsm.core.worlds.WorldWrapper
server() (emsm.core.worlds.WorldWrapper method), 40
attribute), 41
server_() (emsm.core.paths.Pathsystem method), 31
world_uninstalled (emsm.core.worlds.WorldWrapper atServerConfiguration (class in emsm.core.conf), 28
tribute), 41
ServerError, 34
WorldCommandTimeout, 37
ServerInstallationFailure, 34
WorldError, 37
ServerIsOfflineError, 34
WorldIsOfflineError, 37
ServerIsOnlineError, 34
WorldIsOnlineError, 37
ServerManager (class in emsm.core.server), 36
WorldManager (class in emsm.core.worlds), 41
ServerStatusError, 34
worldpath_to_ospath() (emsm.core.worlds.WorldWrapper
set_exit_code()
(emsm.core.application.Application
method), 41
method), 24

64

Index

Extendable Minecraft Server Manager Documentation, Release 4.0.13-beta

worlds() (emsm.core.application.Application method), 24


worlds() (emsm.core.conf.Configuration method), 28
worlds() (emsm.core.paths.Pathsystem method), 32
WorldsConfiguration (class in emsm.core.conf), 28
WorldStartFailed, 37
WorldStatusError, 37
WorldStopFailed, 37
WorldWrapper (class in emsm.core.worlds), 37
write() (emsm.core.conf.ConfigParser method), 27
write() (emsm.core.conf.Configuration method), 29
WrongUserError, 23

Index

65

Вам также может понравиться