Class CommandFeedback

java.lang.Object
org.samo_lego.config2brigadier.common.command.CommandFeedback

public class CommandFeedback extends Object
Takes care of field editing and feedbacks for executed commands.
  • Constructor Details

    • CommandFeedback

      public CommandFeedback()
  • Method Details

    • editConfigAttribute

      public static int editConfigAttribute(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute, Object value, Predicate<Field> fieldConsumer)
      Edits the config field.
      Parameters:
      context - command executor to send feedback to.
      parent - parent object that contains field that will be changed.
      config - the config object which fields are getting modified.
      attribute - field to edit.
      value - new value for the field.
      fieldConsumer - lambda that modifies the field (needs to be different for each primitive). Should return true for success, false on error.
      Returns:
      1 for success, 0 for error.
    • editConfigBoolean

      public static int editConfigBoolean(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
      Edits the config boolean field.
      Parameters:
      context - command executor to send feedback to.
      parent - parent object that contains field that will be changed.
      config - the config object which fields are getting modified.
      attribute - field to edit.
      Returns:
      1 for success, 0 for error.
    • editConfigInt

      public static int editConfigInt(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
      Edits the config integer field.
      Parameters:
      context - command executor to send feedback to.
      parent - parent object that contains field that will be changed.
      config - the config object which fields are getting modified.
      attribute - field to edit.
      Returns:
      1 for success, 0 for error.
    • editConfigFloat

      public static int editConfigFloat(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
      Edits the config float field.
      Parameters:
      context - command executor to send feedback to.
      parent - parent object that contains field that will be changed.
      config - the config object which fields are getting modified.
      attribute - field to edit.
      Returns:
      1 for success, 0 for error.
    • editConfigDouble

      public static int editConfigDouble(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
      Edits the config double field.
      Parameters:
      context - command executor to send feedback to.
      parent - parent object that contains field that will be changed.
      config - the config object which fields are getting modified.
      attribute - field to edit.
      Returns:
      1 for success, 0 for error.
    • editConfigObject

      public static int editConfigObject(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
      Edits the config object field.
      Parameters:
      context - command executor to send feedback to.
      parent - parent object that contains field that will be changed.
      config - the config object which fields are getting modified.
      attribute - field to edit.
      Returns:
      1 for success, 0 for error.