Class CommandHelper

java.lang.Object
my.celium.org.command.CommandHelper

public final class CommandHelper extends Object
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 Type
    Method
    Description
    static void
    failure(net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.Component message)
    Sends a failure message.
    static void
    info(net.minecraft.commands.CommandSourceStack source, net.minecraft.network.chat.Component message)
    Sends an informational message.
    static boolean
    isPlayer(net.minecraft.commands.CommandSourceStack source)
    Whether the source is a player (as opposed to console/command block).
    static boolean
    permission(net.minecraft.commands.CommandSourceStack source, int level)
    Requirement: operator permission level level or higher, using vanilla's 0 (all) through 4 (owners) ladder.
    static net.minecraft.server.level.ServerPlayer
    player(net.minecraft.commands.CommandSourceStack source)
    The executing player, or a vanilla "not a player" error for consoles.
    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).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • permission

      public static boolean permission(net.minecraft.commands.CommandSourceStack source, int level)
      Requirement: operator permission level level or higher, using vanilla's 0 (all) through 4 (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 the sendCommandFeedback game 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.