Skip to content

Run Slash Command

Utility class for running slash commands on the Minecraft server.

RunSlashCommandExample.java
import dev.matthiesen.matthiesen_core.common.utility.commands.RunSlashCommand;
public class RunSlashCommandExample {
public static void asServerExample() {
// Run a command as the server
RunSlashCommand.asServer("say Hello, world!");
}
public static void asPlayerExample(ServerPlayer player) {
// Run a command as a specific player
RunSlashCommand.asPlayer(player, "say Hello from the player!");
}
}