Class CommandFeedback
java.lang.Object
org.samo_lego.config2brigadier.common.command.CommandFeedback
Takes care of field editing and feedbacks for executed commands.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.static int
editConfigBoolean
(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config boolean field.static int
editConfigDouble
(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config double field.static int
editConfigFloat
(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config float field.static int
editConfigInt
(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config integer field.static int
editConfigObject
(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config object field.
-
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.
-