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>>
A command argument that can dynamically resolve to a colony id.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classNested classes/interfaces inherited from class com.minecolonies.core.commands.arguments.MultipleOptionsArgument
MultipleOptionsArgument.ArgumentOption<TValue>, MultipleOptionsArgument.OptionContainer<TValue> -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull IColonygetColony(@NotNull com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, @NotNull String name) Resolve the actual argument value into a colony.static intgetColonyId(@NotNull com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, @NotNull String name) Resolve the actual argument value into a colony id.static ColonyIdArgumentid()static @Nullable IColonytryGetColony(@NotNull com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> context, @NotNull String name, boolean report) Resolve the actual argument value into a colony.Methods inherited from class com.minecolonies.core.commands.arguments.MultipleOptionsArgument
getValue, listSuggestions, parseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mojang.brigadier.arguments.ArgumentType
getExamples
-
Method Details
-
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).
-