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.
    • editConfigAttribute

      public static int editConfigAttribute(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute, Object value, String translationKey, boolean swapArgs, Predicate<Field> fieldConsumer)
      Edits the config field with custom translation key.
      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.
      translationKey - custom translation key for success message.
      swapArgs - whether to swap optionText and newValue in translation.
      fieldConsumer - lambda that modifies the field.
      Returns:
      1 for success, 0 for error.
    • getArg

      public static Object getArg(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, String name, Class<?> type)
    • 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.
    • 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.
    • 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.
    • 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.
    • 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.
    • editConfigMapSet

      public static int editConfigMapSet(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
    • editConfigMapRemove

      public static int editConfigMapRemove(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
    • editConfigListAdd

      public static int editConfigListAdd(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
    • editConfigListSet

      public static int editConfigListSet(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
    • editConfigListInsert

      public static int editConfigListInsert(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
    • editConfigListRemove

      public static int editConfigListRemove(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
    • editConfigSetAdd

      public static int editConfigSetAdd(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)
    • editConfigSetRemove

      public static int editConfigSetRemove(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute)