Class ColonyIdArgument

java.lang.Object
com.minecolonies.core.commands.arguments.MultipleOptionsArgument<Integer>
com.minecolonies.core.commands.arguments.ColonyIdArgument
All Implemented Interfaces:
com.mojang.brigadier.arguments.ArgumentType<MultipleOptionsArgument.OptionContainer<Integer>>

public class ColonyIdArgument extends MultipleOptionsArgument<Integer>
A command argument that can dynamically resolve to a colony id.
  • Method Details

    • id

      public static ColonyIdArgument id()
    • tryGetColony

      @Nullable public static @Nullable IColony tryGetColony(@NotNull @NotNull com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, @NotNull @NotNull String name, boolean report)
      Resolve the actual argument value into a colony.
      Parameters:
      context - the command context.
      name - the argument name.
      report - report failure to the command source.
      Returns:
      the colony, or null if there is no such colony.
    • getColonyId

      public static int getColonyId(@NotNull @NotNull com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, @NotNull @NotNull String name)
      Resolve the actual argument value into a colony id.
      Parameters:
      context - the command context.
      name - the argument name.
      Returns:
      the colony id.
      Throws:
      RuntimeException - if a colony id cannot be parsed from the given argument (this is already reported back).
    • getColony

      @NotNull public static @NotNull IColony getColony(@NotNull @NotNull com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, @NotNull @NotNull String name)
      Resolve the actual argument value into a colony.
      Parameters:
      context - the command context.
      name - the argument name.
      Returns:
      the colony.
      Throws:
      net.minecraft.commands.CommandRuntimeException - if a colony id cannot be parsed from the given argument (this is already reported back).