Class CommandFeedback
java.lang.Object
org.samo_lego.config2brigadier.common.command.CommandFeedback
Takes care of field editing and feedbacks for executed commands.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic inteditConfigAttribute(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.static inteditConfigAttribute(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 inteditConfigBoolean(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config boolean field.static inteditConfigDouble(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config double field.static inteditConfigFloat(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config float field.static inteditConfigInt(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config integer field.static inteditConfigListAdd(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) static inteditConfigListInsert(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) static inteditConfigListRemove(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) static inteditConfigListSet(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) static inteditConfigMapRemove(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) static inteditConfigMapSet(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) static inteditConfigObject(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) Edits the config object field.static inteditConfigSetAdd(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) static inteditConfigSetRemove(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, Object parent, IBrigadierConfigurator config, Field attribute) static ObjectgetArg(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, String name, Class<?> type)
-
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
-
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)
-