public abstract class PixelmonCommand
extends net.minecraft.command.CommandBase
Modifier and Type | Field and Description |
---|---|
java.util.List<java.lang.String> |
aliases |
protected java.lang.String |
name |
protected int |
permission |
protected java.lang.String |
usage |
Modifier | Constructor and Description |
---|---|
|
PixelmonCommand() |
protected |
PixelmonCommand(java.lang.String name,
java.lang.String usage,
int permissionLevel) |
Modifier and Type | Method and Description |
---|---|
static void |
endCommand(java.lang.String message,
java.lang.Object... data)
Terminates the command with a message
|
protected abstract void |
execute(net.minecraft.command.ICommandSender sender,
java.lang.String[] args) |
void |
execute(net.minecraft.server.MinecraftServer server,
net.minecraft.command.ICommandSender sender,
java.lang.String[] args) |
static com.mojang.authlib.GameProfile |
findProfile(java.lang.String username) |
static net.minecraft.util.text.ITextComponent |
format(java.lang.String lang,
java.lang.Object... args) |
static net.minecraft.util.text.ITextComponent |
format(net.minecraft.util.text.TextFormatting color,
java.lang.String lang,
java.lang.Object... args) |
java.util.List<java.lang.String> |
getAliases()
Get a list of aliases for this command.
|
static PCStorage |
getComputerStorage(net.minecraft.entity.player.EntityPlayerMP player)
Shortcut call to
IStorageManager.getPCForPlayer(EntityPlayerMP) |
static net.minecraft.entity.player.EntityPlayerMP |
getEntityPlayer(java.lang.String username)
Gets the entityPlayer if they are online else returns null
|
static net.minecraft.entity.player.EntityPlayerMP |
getEntityPlayer(java.util.UUID uuid)
Gets the entityPlayer if they are online else returns null
|
java.lang.String |
getName()
Gets the name of the command
|
static net.minecraft.entity.player.EntityPlayerMP |
getPlayer(net.minecraft.command.ICommandSender sender,
java.lang.String name)
Shortcut call to
PixelmonPlayerUtils.getUniquePlayerStartingWith(String, ICommandSender) . |
static net.minecraft.entity.player.EntityPlayerMP |
getPlayer(java.lang.String name)
Shortcut call to
PixelmonPlayerUtils.getUniquePlayerStartingWith(String) . |
static PlayerPartyStorage |
getPlayerStorage(net.minecraft.entity.player.EntityPlayerMP player)
Shortcut call to
IStorageManager.getParty(EntityPlayerMP) . |
int |
getRequiredPermissionLevel()
Return the required permission level for this command.
|
static net.minecraft.server.MinecraftServer |
getServer()
Shortcut to
FMLCommonHandler.getMinecraftServerInstance() . |
java.lang.String |
getUsage(net.minecraft.command.ICommandSender sender)
Gets the usage string for the command.
|
static <T> T |
require(java.util.Optional<T> optional,
java.lang.String message,
java.lang.Object... data) |
static <T> T |
require(T obj,
java.lang.String message,
java.lang.Object... data) |
static net.minecraft.entity.player.EntityPlayerMP |
requireEntityPlayer(net.minecraft.command.ICommandSender sender)
Checks if the commandSender is a player and returns the entityPlayer if true.
|
static net.minecraft.entity.player.EntityPlayerMP |
requireEntityPlayer(java.lang.String username)
Checks if the user is online.
|
static int |
requireInt(java.lang.String input,
int min,
int max,
java.lang.String message,
java.lang.Object... data) |
static int |
requireInt(java.lang.String input,
java.lang.String message) |
protected void |
resendWithMultipleTargets(net.minecraft.command.ICommandSender sender,
java.lang.String[] args,
int playerIndex) |
void |
sendMessage(net.minecraft.command.ICommandSender sender,
java.lang.String string,
java.lang.Object... data)
Sends a gray message to the given
ICommandSender . |
void |
sendMessage(net.minecraft.command.ICommandSender sender,
net.minecraft.util.text.TextFormatting color,
java.lang.String string,
java.lang.Object... data)
Sends a message to the given
ICommandSender . |
static java.util.List<java.lang.String> |
tabComplete(java.lang.String[] args,
java.util.Collection options) |
static java.util.List<java.lang.String> |
tabComplete(java.lang.String[] args,
java.lang.String... options) |
static java.util.List<java.lang.String> |
tabCompletePokemon(java.lang.String[] args)
Gets a tab-complete list for Pokémon names.
|
static java.util.List<java.lang.String> |
tabCompleteUsernames(java.lang.String[] args)
Gets a tab-complete list for player names.
|
buildString, checkPermission, compareTo, convertArgToBlockState, convertArgToBlockStatePredicate, doesStringStartWith, entityToNBT, getBlockByText, getChatComponentFromNthArg, getChatComponentFromNthArg, getCommandSenderAsPlayer, getEntity, getEntity, getEntityList, getEntityName, getItemByText, getListOfStringsMatchingLastWord, getListOfStringsMatchingLastWord, getPlayer, getPlayerName, getPlayers, getTabCompletionCoordinate, getTabCompletionCoordinateXZ, getTabCompletions, isUsernameIndex, join, joinNiceString, joinNiceStringFromCollection, notifyCommandListener, notifyCommandListener, parseBlockPos, parseBoolean, parseCoordinate, parseCoordinate, parseDouble, parseDouble, parseDouble, parseDouble, parseDouble, parseInt, parseInt, parseInt, parseLong, parseLong, setCommandListener, toSyntaxException
protected java.lang.String name
protected java.lang.String usage
protected int permission
public java.util.List<java.lang.String> aliases
public PixelmonCommand()
protected PixelmonCommand(java.lang.String name, java.lang.String usage, int permissionLevel)
name
- The name of the command.usage
- The help entry of the command.permissionLevel
- The permission level required to use this command.protected abstract void execute(net.minecraft.command.ICommandSender sender, java.lang.String[] args) throws net.minecraft.command.CommandException
net.minecraft.command.CommandException
public java.lang.String getName()
public java.lang.String getUsage(net.minecraft.command.ICommandSender sender)
sender
- public final void execute(net.minecraft.server.MinecraftServer server, net.minecraft.command.ICommandSender sender, java.lang.String[] args) throws net.minecraft.command.CommandException
net.minecraft.command.CommandException
public int getRequiredPermissionLevel()
getRequiredPermissionLevel
in class net.minecraft.command.CommandBase
public java.util.List<java.lang.String> getAliases()
getAliases
in interface net.minecraft.command.ICommand
getAliases
in class net.minecraft.command.CommandBase
protected void resendWithMultipleTargets(net.minecraft.command.ICommandSender sender, java.lang.String[] args, int playerIndex) throws net.minecraft.command.CommandException
net.minecraft.command.CommandException
@Nonnull public static net.minecraft.entity.player.EntityPlayerMP requireEntityPlayer(net.minecraft.command.ICommandSender sender) throws net.minecraft.command.CommandException
sender
- commandSendernet.minecraft.command.CommandException
- If the command sender is not a player.@Nonnull public static net.minecraft.entity.player.EntityPlayerMP requireEntityPlayer(java.lang.String username) throws net.minecraft.command.CommandException
username
- The username or uuid string to check.net.minecraft.command.CommandException
- if the player is not online or cant be found.public static net.minecraft.entity.player.EntityPlayerMP getEntityPlayer(java.lang.String username)
username
- The username or uuid string to lookupjava.lang.IllegalArgumentException
- if we cant parse the UUIDpublic static net.minecraft.entity.player.EntityPlayerMP getEntityPlayer(java.util.UUID uuid)
uuid
- The uuid of the player to lookuppublic static com.mojang.authlib.GameProfile findProfile(java.lang.String username)
public static int requireInt(java.lang.String input, java.lang.String message) throws net.minecraft.command.CommandException
net.minecraft.command.CommandException
public static int requireInt(java.lang.String input, int min, int max, java.lang.String message, java.lang.Object... data) throws net.minecraft.command.CommandException
net.minecraft.command.CommandException
@Nonnull public static <T> T require(java.util.Optional<T> optional, java.lang.String message, java.lang.Object... data) throws net.minecraft.command.CommandException
net.minecraft.command.CommandException
@Nonnull public static <T> T require(T obj, java.lang.String message, java.lang.Object... data) throws net.minecraft.command.CommandException
net.minecraft.command.CommandException
public static void endCommand(java.lang.String message, java.lang.Object... data) throws net.minecraft.command.CommandException
message
- The message to send to the player.net.minecraft.command.CommandException
- 99.9% of the time.@Nullable public static net.minecraft.entity.player.EntityPlayerMP getPlayer(java.lang.String name)
PixelmonPlayerUtils.getUniquePlayerStartingWith(String)
.@Nullable public static net.minecraft.entity.player.EntityPlayerMP getPlayer(net.minecraft.command.ICommandSender sender, java.lang.String name)
PixelmonPlayerUtils.getUniquePlayerStartingWith(String, ICommandSender)
.@Nullable public static PlayerPartyStorage getPlayerStorage(net.minecraft.entity.player.EntityPlayerMP player)
IStorageManager.getParty(EntityPlayerMP)
.public static PCStorage getComputerStorage(net.minecraft.entity.player.EntityPlayerMP player)
IStorageManager.getPCForPlayer(EntityPlayerMP)
public static net.minecraft.server.MinecraftServer getServer()
FMLCommonHandler.getMinecraftServerInstance()
.public static java.util.List<java.lang.String> tabComplete(java.lang.String[] args, java.lang.String... options)
public static java.util.List<java.lang.String> tabComplete(java.lang.String[] args, java.util.Collection options)
public static java.util.List<java.lang.String> tabCompleteUsernames(java.lang.String[] args)
args
- - The command argumentspublic static java.util.List<java.lang.String> tabCompletePokemon(java.lang.String[] args)
args
- - The command argumentspublic static net.minecraft.util.text.ITextComponent format(net.minecraft.util.text.TextFormatting color, java.lang.String lang, java.lang.Object... args)
public static net.minecraft.util.text.ITextComponent format(java.lang.String lang, java.lang.Object... args)
public void sendMessage(net.minecraft.command.ICommandSender sender, net.minecraft.util.text.TextFormatting color, java.lang.String string, java.lang.Object... data)
ICommandSender
.sender
- - The ICommandSender
to send the message to.color
- - The color of the text.string
- - The message itself or the translation key.data
- - Any relevant translation information to substitute '%s' placeholders.public void sendMessage(net.minecraft.command.ICommandSender sender, java.lang.String string, java.lang.Object... data)
ICommandSender
.sender
- - The ICommandSender
to send the message to.string
- - The message itself or the translation key.data
- - Any relevant translation information to substitute '%s' placeholders.