You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kɜ:ʳ cybredragon b8c558513f update readme 1 month ago
.gitignore big refactor, test message queue 1 month ago
license Create license 3 years ago
message_queue.py fix that bug 1 month ago
message_queue_test.py fix some bugs, another test, possibly enable the sending back to the server 1 month ago
pyproject.toml peg line length at 80 and reformat 1 month ago
readme.md update readme 1 month ago
registration.yaml initial commit 3 years ago
requirements.txt Workinggit add requirements.txt 2 months ago
service.py have to set your own presence 1 month ago
wrapper.py fix regex 1 month ago

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.