Class CommandHelper
java.lang.Object
my.celium.org.command.CommandHelper
Small helpers around vanilla Brigadier. Mycel does not replace Minecraft's
command system - these cover the three lines every mod rewrites.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidfailure(net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.Component message) Sends a failure message.static voidinfo(net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.Component message) Sends an informational message.static booleanisPlayer(net.minecraft.commands.CommandSourceStack source) Whether the source is a player (as opposed to console/command block).static booleanpermission(net.minecraft.commands.CommandSourceStack source, int level) Requirement: operator permission levellevelor higher, using vanilla's0(all) through4(owners) ladder.static net.minecraft.server.level.ServerPlayerplayer(net.minecraft.commands.CommandSourceStack source) The executing player, or a vanilla "not a player" error for consoles.static voidsuccess(net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.Component message) Sends a success message (appears in chat, not the action bar).
-
Method Details
-
permission
public static boolean permission(net.minecraft.commands.CommandSourceStack source, int level) Requirement: operator permission levellevelor higher, using vanilla's0(all) through4(owners) ladder. -
player
public static net.minecraft.server.level.ServerPlayer player(net.minecraft.commands.CommandSourceStack source) throws com.mojang.brigadier.exceptions.CommandSyntaxException The executing player, or a vanilla "not a player" error for consoles.- Throws:
com.mojang.brigadier.exceptions.CommandSyntaxException
-
isPlayer
public static boolean isPlayer(net.minecraft.commands.CommandSourceStack source) Whether the source is a player (as opposed to console/command block). -
success
public static void success(net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.Component message) Sends a success message (appears in chat, not the action bar). -
info
public static void info(net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.Component message) Sends an informational message. The component is delivered as-is so hex colors and hover text survive (older builds flattened everything to grey). -
failure
public static void failure(net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.Component message) Sends a failure message. Goes through vanilla's failure channel, so it still shows when thesendCommandFeedbackgame rule is off. Vanilla paints the root legacy red, so the message rides one level down with the wiki body color; parts without their own color never turn§c.
-