Skip to content

Commit

Permalink
Fixed up some of the documentation and added some images.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenCochell committed Jul 8, 2020
1 parent 0500315 commit 576de39
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 19 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Minecraft Connection Tools
A python implementation for interacting with Minecraft servers.

[![Documentation Status](https://readthedocs.org/projects/mctools/badge/?version=latest)](https://mctools.readthedocs.io/en/latest/?badge=latest)

# Introduction

mctools allows you to interact with Minecraft servers via [rcon](https://wiki.vg/RCON),
Expand Down Expand Up @@ -51,7 +53,7 @@ Send a command to the Minecraft server via rcon:
$ pip install mctools[color]

For more information on installing mctools, check out the instillation section in our
[documentation](https://mctools.readthedocs.io/).
[documentation](https://mctools.readthedocs.io/en/latest/install.html).

# Formatting

Expand Down Expand Up @@ -90,7 +92,7 @@ Send a command to the Minecraft server via rcon:
player sample list.

To learn more about formatters, and how to create your own,
then please check out the [formatting documentation](https://mctools.readthedocs.io/).
then please check out the [formatting documentation](https://mctools.readthedocs.io/en/latest/format.html).

# Command line tool

Expand All @@ -105,7 +107,7 @@ Send a command to the Minecraft server via rcon:
install via pip/setuptools.

This will generate the help menu for mcli. To learn more about mcli, please check out the
[mcli documentation](https://mctools.readthedocs.io/).
[mcli documentation](https://mctools.readthedocs.io/en/latest/mcli.html).

# Documentation

Expand All @@ -117,6 +119,6 @@ Send a command to the Minecraft server via rcon:
# Conclusion

mctools offers a pythonic, reliable way to interact with Minecraft servers, without being too complicated.
If you have any questions or issues, then please open an issue. Pull requests of any kind a welcome and encouraged!
If you have any questions or problems, then please open an issue. Pull requests of any kind a welcome and encouraged!

Thank you for reading!
70 changes: 56 additions & 14 deletions docs/source/mcli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ General Usage

This section defines general usage for mcli.py

.. note::

From this point onwards, we reference mcli.py as mcli,
which is how you would call the command if you installed via pip or setuptools.

However, if you downloaded the source code or the source distribution without installing,
the you will call mcli as a python file:

.. code-block:: python
python3 mcli.py [arguments]
General Arguments
-----------------

Expand Down Expand Up @@ -74,7 +86,7 @@ For example, let's say you wanted to connect to 'mc.server.net' on port 12345:

.. code-block:: python
python3 mcli.py mc.server.net:12345 [...]
mcli mc.server.net:12345 [...]
This will set the port number to 12345.

Expand All @@ -92,7 +104,7 @@ Each connection type has specific arguments, which we will be going into. For no

.. code-block:: python
python3 mcli.py mc.server.net rcon [...]
mcli mc.server.net rcon [...]
This will start a RCON connection to 'mc.server.net'.

Expand All @@ -114,14 +126,14 @@ After you have specified your optional parameters, you must provide a password.

.. code-block:: python
python3 mcli.py [OPTIONAL ARGUMENTS] mc.server.net rcon [OPTIONAL ARGUMENTS] [PASSWORD]
mcli [OPTIONAL ARGUMENTS] mc.server.net rcon [OPTIONAL ARGUMENTS] [PASSWORD]
For example, let's say you wanted to start an interactive RCON session with 'mc.server.net' with the password
'Minecraft is Cool!':

.. code-block:: python
python3 mcli.py mc.server.net rcon --interactive 'Minecraft is Cool!'
mcli mc.server.net rcon --interactive 'Minecraft is Cool!'
This will create an interactive RCON session with 'mc.server.net'.
Expand All @@ -140,7 +152,7 @@ For example, lets say you wanted to retrieve full Query statistics from 'mc.serv

.. code-block:: python
python3 mcli.py mc.server.net:1234 query -fs
mcli mc.server.net:1234 query -fs
PING Usage
==========
Expand All @@ -160,7 +172,7 @@ For example, lets say you wanted to ping 'mc.server.net', but pretend to be Mine

.. code-block:: python
python3 mcli.py mc.server.net ping -p 393
mcli mc.server.net ping -p 393
Examples
========
Expand All @@ -171,46 +183,76 @@ Ping server and get basic stats:

.. code-block:: python
mcli.py [hostname] ping
mcli [hostname] ping
Backup and stop a Minecraft server via RCON:

.. code-block:: python
mcli.py [hostname] rcon --command backup --command stop [password]
mcli [hostname] rcon --command backup --command stop [password]
Message player 'ILoveCraft' on 'mc.server.net' with password 'craft':

.. code-block:: python
mcli.py mc.server.net rcon --command 'msg ILoveCraft Minecraft loves you too!' craft
mcli mc.server.net rcon --command 'msg ILoveCraft Minecraft loves you too!' craft
Start an interactive RCON session with 'mc.example.com' on port 858585, with test as the password:

.. code-block:: python
mcli.py mc.example.com:858585 rcon --interactive test
mcli mc.example.com:858585 rcon --interactive test
Get full stats via Query and output the result to 'query.txt':

.. code-block:: python
mcli.py -o query.txt [hostanme] query --full-stats
mcli -o query.txt [hostanme] query --full-stats
Get basic stats via query and disable color:

.. code-block:: python
mcli.py --no-color [hostname] query
mcli --no-color [hostname] query
Ping server, but leave format chars:

.. code-block:: python
mcli.py --raw [hostname] ping
mcli --raw [hostname] ping
Screenshots
===========

Here are some screenshots of mcli in action:

RCON Usage
----------

Interactive RCON session

.. image:: rcon.png
:alt: rcon screenshot

Query usage
-----------

Fetching full statistics via Query

.. image:: query.png
:alt: query screenshot
:height: 300px

Ping usage
----------

Pinging Minecraft server and fetching statistics

.. image:: ping.png
:alt: query screenshot

Conclusion
==========

You should now have a basic understanding of the 'mcli.py' frontend and how to use it.
After you install mctools throught pip(or some other method), then the 'mcli' command should be available.
After you install mctools through pip(or some other method), then the 'mcli' command should be available.
Binary file added docs/source/ping.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion docs/source/ping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ You can find a list of protocol numbers and their versions `here <https://wiki.v
Pinging the server
------------------

.. warning::

The server will automatically close the connection after you ping the server or fetch statistics.
This means you must create a new PINGClient after the operation is complete.

Once you have created your PINGClient, you can ping the server:

.. code-block:: python
Expand Down Expand Up @@ -130,7 +135,7 @@ However, some servers take it upon themselves to embed messages into the player
or give the description in `ChatObject <https://wiki.vg/Chat>`_ notation. If you have formatting enabled,
then these cases are automatically handled for you.

You can read more about the ping formatters and how they handel data in the `Forrmatting tutorial <format.html>`_
You can read more about the ping formatters and how they handel data in the `Forrmatting tutorial <format.html>`_.

Stopping the instance
---------------------
Expand Down
Binary file added docs/source/query.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/rcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 576de39

Please sign in to comment.