1
0
Fork 0
Go to file
khr b8c558513f update readme 2020-04-03 00:00:03 -07:00
.gitignore big refactor, test message queue 2020-04-01 23:33:34 -07:00
license Create license 2017-04-11 20:07:00 -04:00
message_queue.py fix that bug 2020-04-02 21:54:01 -07:00
message_queue_test.py fix some bugs, another test, possibly enable the sending back to the server 2020-04-02 19:31:53 -07:00
pyproject.toml peg line length at 80 and reformat 2020-03-29 19:07:53 -07:00
readme.md update readme 2020-04-03 00:00:03 -07:00
registration.yaml initial commit 2017-04-11 20:05:12 -04:00
requirements.txt Workinggit add requirements.txt 2020-03-29 09:00:58 +02:00
service.py have to set your own presence 2020-04-03 08:38:49 +02:00
wrapper.py fix regex 2020-04-03 06:39:22 +00:00

readme.md

Some Python code for plumbing together a Matrix room and a Minecraft server chat

This project is a fork of paftree/matrixcraft-bridge that cleans up the code and adds some new functionality, such as synchronizing Matrix presence with Minecraft login/logout events.

Setup the application service (bridge part) first:

  • Clone this repo on your homeserver.
  • Install the packages in requirements.txt
  • Add registration.yaml to your homeserver config:
app_service_config_files:
 - "/path/to/.../registration.yaml"
  • There are two tokens that need to be added to registration.yaml. The as_token should be saved and passed on the command line as --appservice_token to service.py.
  • Run service.py (ideally as e.g. a systemd service).
    • --matrix_server_name is used to generate user IDs on the local server for Minecraft users.
    • --matrix_api_port should be the port you specify in registration.yaml.
    • --minecraft_wrapper_port is the port you wish the service to bind to for communicating with the Minecraft server. (If the Minecraft server is not local, you should make sure to open this port in your firewall. Note that it is not authenticated, so it may not be wise to allow all traffic through this port.)

Then set up the Minecraft server wrapper:

  • Clone this repo on your Matrix server host.
  • Install the packages in requirements.txt
  • Run wrapper.py as follows:

python wrapper.py --matrix_server example.com --matrix_server_port 5001 java -Xmx1024M -Xms1024M -jar minecraft_server.1.11.2.jar

  • --matrix_server should be the domain name or IP address which resolves to your matrix server (could be different from --matrix_server_name).
  • --matrix_server_port is the port you specified as --minecraft_wrapper_port above.

Quirks:

  • You have to invite the appservice user (e.g. minecraft_bridge) to a room to bridge that room with the Minecraft server
  • Once the appservice user is invited, if you restart the appservice, you may have to generate an event (e.g. type a message) to get the appservice to bridge your room properly.