public abstract class CommandBase extends java.lang.Object implements ICommand
Modifier and Type | Class and Description |
---|---|
static class |
CommandBase.CoordinateArg |
Constructor and Description |
---|
CommandBase() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
buildString(java.lang.String[] args,
int startPos)
Builds a string starting at startPos
|
boolean |
checkPermission(MinecraftServer server,
ICommandSender sender)
Check if the given ICommandSender has permission to execute this command
|
int |
compareTo(ICommand p_compareTo_1_) |
static IBlockState |
convertArgToBlockState(Block p_190794_0_,
java.lang.String p_190794_1_) |
static <any> |
convertArgToBlockStatePredicate(Block p_190791_0_,
java.lang.String p_190791_1_) |
static boolean |
doesStringStartWith(java.lang.String original,
java.lang.String region)
Returns true if the given substring is exactly equal to the start of the given string (case insensitive).
|
protected static NBTTagCompound |
entityToNBT(Entity theEntity) |
java.util.List<java.lang.String> |
getAliases()
Get a list of aliases for this command.
|
static Block |
getBlockByText(ICommandSender sender,
java.lang.String id)
Gets the Block specified by the given text string.
|
static ITextComponent |
getChatComponentFromNthArg(ICommandSender sender,
java.lang.String[] args,
int index) |
static ITextComponent |
getChatComponentFromNthArg(ICommandSender sender,
java.lang.String[] args,
int index,
boolean p_147176_3_) |
static EntityPlayerMP |
getCommandSenderAsPlayer(ICommandSender sender)
Returns the given ICommandSender as a EntityPlayer or throw an exception.
|
static Entity |
getEntity(MinecraftServer server,
ICommandSender sender,
java.lang.String target) |
static <T extends Entity> |
getEntity(MinecraftServer server,
ICommandSender sender,
java.lang.String target,
java.lang.Class<? extends T> targetClass) |
static java.util.List<Entity> |
getEntityList(MinecraftServer server,
ICommandSender sender,
java.lang.String target) |
static java.lang.String |
getEntityName(MinecraftServer server,
ICommandSender sender,
java.lang.String target) |
static Item |
getItemByText(ICommandSender sender,
java.lang.String id)
Gets the Item specified by the given text string.
|
static java.util.List<java.lang.String> |
getListOfStringsMatchingLastWord(java.lang.String[] inputArgs,
java.util.Collection<?> possibleCompletions) |
static java.util.List<java.lang.String> |
getListOfStringsMatchingLastWord(java.lang.String[] args,
java.lang.String... possibilities)
Returns a List of strings (chosen from the given strings) which the last word in the given string array is a
beginning-match for.
|
static EntityPlayerMP |
getPlayer(MinecraftServer server,
ICommandSender sender,
java.lang.String target) |
static java.lang.String |
getPlayerName(MinecraftServer server,
ICommandSender sender,
java.lang.String target) |
int |
getRequiredPermissionLevel()
Return the required permission level for this command.
|
static java.util.List<java.lang.String> |
getTabCompletionCoordinate(java.lang.String[] inputArgs,
int index,
BlockPos pos) |
static java.util.List<java.lang.String> |
getTabCompletionCoordinateXZ(java.lang.String[] inputArgs,
int index,
BlockPos lookedPos) |
java.util.List<java.lang.String> |
getTabCompletions(MinecraftServer server,
ICommandSender sender,
java.lang.String[] args,
BlockPos targetPos)
Get a list of options for when the user presses the TAB key
|
boolean |
isUsernameIndex(java.lang.String[] args,
int index)
Return whether the specified command parameter index is a username parameter.
|
static ITextComponent |
join(java.util.List<ITextComponent> components) |
static java.lang.String |
joinNiceString(java.lang.Object[] elements)
Creates a linguistic series joining the input objects together.
|
static java.lang.String |
joinNiceStringFromCollection(java.util.Collection<java.lang.String> strings)
Creates a linguistic series joining together the elements of the given collection.
|
static void |
notifyCommandListener(ICommandSender sender,
ICommand command,
int flags,
java.lang.String translationKey,
java.lang.Object... translationArgs) |
static void |
notifyCommandListener(ICommandSender sender,
ICommand command,
java.lang.String translationKey,
java.lang.Object... translationArgs) |
static BlockPos |
parseBlockPos(ICommandSender sender,
java.lang.String[] args,
int startIndex,
boolean centerBlock) |
static boolean |
parseBoolean(java.lang.String input) |
static CommandBase.CoordinateArg |
parseCoordinate(double base,
java.lang.String selectorArg,
boolean centerBlock) |
static CommandBase.CoordinateArg |
parseCoordinate(double base,
java.lang.String selectorArg,
int min,
int max,
boolean centerBlock) |
static double |
parseDouble(double base,
java.lang.String input,
boolean centerBlock) |
static double |
parseDouble(double base,
java.lang.String input,
int min,
int max,
boolean centerBlock) |
static double |
parseDouble(java.lang.String input) |
static double |
parseDouble(java.lang.String input,
double min) |
static double |
parseDouble(java.lang.String input,
double min,
double max) |
static int |
parseInt(java.lang.String input) |
static int |
parseInt(java.lang.String input,
int min) |
static int |
parseInt(java.lang.String input,
int min,
int max) |
static long |
parseLong(java.lang.String input) |
static long |
parseLong(java.lang.String input,
long min,
long max) |
static void |
setCommandListener(ICommandListener listener)
Sets the command listener responsable for notifying server operators when asked to by commands
|
protected static SyntaxErrorException |
toSyntaxException(JsonParseException e)
Convert a JsonParseException into a user-friendly exception
|
protected static SyntaxErrorException toSyntaxException(JsonParseException e)
protected static NBTTagCompound entityToNBT(Entity theEntity)
public int getRequiredPermissionLevel()
public java.util.List<java.lang.String> getAliases()
getAliases
in interface ICommand
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
checkPermission
in interface ICommand
server
- The server instancesender
- The ICommandSender to check permissions onpublic java.util.List<java.lang.String> getTabCompletions(MinecraftServer server, ICommandSender sender, java.lang.String[] args, BlockPos targetPos)
getTabCompletions
in interface ICommand
server
- The server instancesender
- The ICommandSender to get tab completions forargs
- Any arguments that were present when TAB was pressedtargetPos
- The block that the player's mouse is over, null if the mouse is not over a blockpublic static int parseInt(java.lang.String input) throws NumberInvalidException
NumberInvalidException
public static int parseInt(java.lang.String input, int min) throws NumberInvalidException
NumberInvalidException
public static int parseInt(java.lang.String input, int min, int max) throws NumberInvalidException
NumberInvalidException
public static long parseLong(java.lang.String input) throws NumberInvalidException
NumberInvalidException
public static long parseLong(java.lang.String input, long min, long max) throws NumberInvalidException
NumberInvalidException
public static BlockPos parseBlockPos(ICommandSender sender, java.lang.String[] args, int startIndex, boolean centerBlock) throws NumberInvalidException
NumberInvalidException
public static double parseDouble(java.lang.String input) throws NumberInvalidException
NumberInvalidException
public static double parseDouble(java.lang.String input, double min) throws NumberInvalidException
NumberInvalidException
public static double parseDouble(java.lang.String input, double min, double max) throws NumberInvalidException
NumberInvalidException
public static boolean parseBoolean(java.lang.String input) throws CommandException
CommandException
public static EntityPlayerMP getCommandSenderAsPlayer(ICommandSender sender) throws PlayerNotFoundException
PlayerNotFoundException
public static EntityPlayerMP getPlayer(MinecraftServer server, ICommandSender sender, java.lang.String target) throws PlayerNotFoundException, CommandException
public static Entity getEntity(MinecraftServer server, ICommandSender sender, java.lang.String target) throws EntityNotFoundException, CommandException
public static <T extends Entity> T getEntity(MinecraftServer server, ICommandSender sender, java.lang.String target, java.lang.Class<? extends T> targetClass) throws EntityNotFoundException, CommandException
public static java.util.List<Entity> getEntityList(MinecraftServer server, ICommandSender sender, java.lang.String target) throws EntityNotFoundException, CommandException
public static java.lang.String getPlayerName(MinecraftServer server, ICommandSender sender, java.lang.String target) throws PlayerNotFoundException, CommandException
public static java.lang.String getEntityName(MinecraftServer server, ICommandSender sender, java.lang.String target) throws EntityNotFoundException, CommandException
public static ITextComponent getChatComponentFromNthArg(ICommandSender sender, java.lang.String[] args, int index) throws CommandException, PlayerNotFoundException
public static ITextComponent getChatComponentFromNthArg(ICommandSender sender, java.lang.String[] args, int index, boolean p_147176_3_) throws PlayerNotFoundException, CommandException
public static java.lang.String buildString(java.lang.String[] args, int startPos)
public static CommandBase.CoordinateArg parseCoordinate(double base, java.lang.String selectorArg, boolean centerBlock) throws NumberInvalidException
NumberInvalidException
public static CommandBase.CoordinateArg parseCoordinate(double base, java.lang.String selectorArg, int min, int max, boolean centerBlock) throws NumberInvalidException
NumberInvalidException
public static double parseDouble(double base, java.lang.String input, boolean centerBlock) throws NumberInvalidException
NumberInvalidException
public static double parseDouble(double base, java.lang.String input, int min, int max, boolean centerBlock) throws NumberInvalidException
NumberInvalidException
public static Item getItemByText(ICommandSender sender, java.lang.String id) throws NumberInvalidException
NumberInvalidException
public static Block getBlockByText(ICommandSender sender, java.lang.String id) throws NumberInvalidException
NumberInvalidException
public static IBlockState convertArgToBlockState(Block p_190794_0_, java.lang.String p_190794_1_) throws NumberInvalidException, InvalidBlockStateException
public static <any> convertArgToBlockStatePredicate(Block p_190791_0_, java.lang.String p_190791_1_) throws InvalidBlockStateException
InvalidBlockStateException
public static java.lang.String joinNiceString(java.lang.Object[] elements)
public static ITextComponent join(java.util.List<ITextComponent> components)
public static java.lang.String joinNiceStringFromCollection(java.util.Collection<java.lang.String> strings)
public static java.util.List<java.lang.String> getTabCompletionCoordinate(java.lang.String[] inputArgs, int index, BlockPos pos)
public static java.util.List<java.lang.String> getTabCompletionCoordinateXZ(java.lang.String[] inputArgs, int index, BlockPos lookedPos)
public static boolean doesStringStartWith(java.lang.String original, java.lang.String region)
public static java.util.List<java.lang.String> getListOfStringsMatchingLastWord(java.lang.String[] args, java.lang.String... possibilities)
public static java.util.List<java.lang.String> getListOfStringsMatchingLastWord(java.lang.String[] inputArgs, java.util.Collection<?> possibleCompletions)
public boolean isUsernameIndex(java.lang.String[] args, int index)
isUsernameIndex
in interface ICommand
args
- The arguments of the command invocationindex
- The indexpublic static void notifyCommandListener(ICommandSender sender, ICommand command, java.lang.String translationKey, java.lang.Object... translationArgs)
public static void notifyCommandListener(ICommandSender sender, ICommand command, int flags, java.lang.String translationKey, java.lang.Object... translationArgs)
public static void setCommandListener(ICommandListener listener)