Argon is a Mindustry RabbitMQ client that sends events across servers through the use of Mindustry-like events.
package example;
import Argon.Argon;
import Argon.RegisterArgonEvents;
import arc.Events;
import arc.util.Log;
import mindustry.Vars;
import mindustry.game.EventType;
import mindustry.mod.Plugin;
public class Example extends Plugin {
@Override
public void init() {
Events.on(EventType.PlayerBanEvent.class, event -> {
Log.debug("Firing ban event across servers");
Argon.fire(new PlayerKick(event.uuid, event.player.con.address));
});
Events.on(RegisterArgonEvents.class, ignored -> {
//Argon events listeners go here
Argon.on(PlayerKick.class, event -> {
Log.debug("Received ban event");
Vars.netServer.admins.banPlayer(event.uuid);
Vars.netServer.admins.banPlayerIP(event.ip);
});
});
}
private record PlayerKick(String uuid, String ip) {}
}
Google how to install a RabbitMQ server, or chatGPT it. The following is a basic, not all-encompassing guide for linux.
- Install Rabbit MQ on your server.
sudo apt install rabbitmq-server
- Create a RabbitMQ User
sudo rabbitmqctl add_user username password
- Grant the user external access (so it can talk outside localhost)
sudo rabbitmqctl set_permissions -p / username ".*" ".*" ".*"
- Restart RabbitMQ
sudo systemctl restart rabbitmq-server
- Go to Relases, download
Argon.jar
, and place it inside your mindustry server'smods
folder. - Find
./config/mods/Argon/config.json
and set the proper RabbitMQ url, port, username and password.
In order to use this plugin with your custom plugin, you will need to add Argon as dependency.
In gradle, add the following:
repositories {
//other repositories like maven central
maven{ url 'https://www.jitpack.io' }
}
dependencies {
//other dependencies
compileOnly "com.github.Atomic-Laboratory:Argon:1.1.3"
}
In your plugins.json, append the following:
{
"dependencies": [
"argon-rabbitmq"
]
}
gradlew jar
/ ./gradlew jar
Output jar should be in build/libs
.