A machine-usable Minecraft chat console client.
-
Clone this repository into an empty directory:
git clone https://github.com/joodicator/mcchat2 cd mcchat2
-
Initialise the submodules:
git submodule update --init --recursive
-
For information on the command-line arguments of mcchat2, see:
./mcchat2.py --help
While running, each line from mcchat2's standard input is sent to the server (if connected) as one or more chat messages, unless it takes one of the following special forms:
Ask for the value of the property called NAME
. The program responds by printing to standard output (possibly after a delay during which other unrelated messages may be printed) either
!query success NAME VALUE...
or!query failure NAME REASON...
If the same property is queried more than once, the program may respond by issuing only a single reply for several identical queries. The property NAME
may be any of the following:
players
- the names of all players on the server, separated by spaces. Only available when connected.agent
- the player name that mcchat2 appears as on the server. Only available when connected.- Any key from the key/value section of Minecraft's query interface. Only available when the server's UDP query interface is enabled.
Cause the program to exit, disconnecting first from the server if necessary. If a REASON
is given, this printed to standard output or standard error; otherwise, it defaults to Manually closed.
If the --quiet
flag is present and the program is currently disconnected from the server in standby mode, the exit reason is printed to standard error rather than standard output. This can be useful in combination with the --quiet-start
command-line flag of mcchat2 to restart the client without causing unnecessary noise.
If --code=N
is given, then N
is used as the exit status code of the program; otherwise, it defaults to 0.
If this command-line option is present, then, when starting and whenever successfully connecting to the server after having previously been disconnected, mcchat2 automatically acts as if ?query map
were issued; and, when successfully connecting to the server, mcchat2 acts as if ?query agent
were issued. This allows a program listening to mcchat2's standard output to stay up to date with the values of these properties without knowing the internal state of mcchat2.
When mcchat2 is run with this plugin loaded, e.g. with --plugins mapimg
in its command-line arguments, then any maps encountered by the client are saved as two image files in plugins/mapimg/maps
:
map_NUMBER.png
- the main map image without any icons.map_NUMBER_icons.png
- an otherwise transparent image containing any map icons.