public abstract class GlowVanillaCommand
extends org.bukkit.command.defaults.VanillaCommand
VanillaCommand
with the additional feature that when the command sender is
a GlowPlayer
, the description, usage and permission-error messages are looked up in the
client's locale, overriding whatever has been or is subsequently set in
Command.setDescription(String)
, Command.setUsage(String)
or
Command.setPermissionMessage(String)
. For non-player command senders and players with unknown
locale ({@link GlowPlayer#getLocale()} == null
), messages set with these setters will be
used, and the initial values are based on the server's locale.Modifier and Type | Class and Description |
---|---|
protected static class |
GlowVanillaCommand.CommandMessages |
static class |
GlowVanillaCommand.GenericMessage
Keys for localizable messages shared by more than one command.
|
Modifier and Type | Field and Description |
---|---|
static long |
CACHE_SIZE |
static String |
JOINER |
Constructor and Description |
---|
GlowVanillaCommand(@NonNls String name)
Creates an instance with no aliases (i.e.
|
GlowVanillaCommand(@NonNls String name,
@NonNls List<String> aliases)
Creates an instance, using the command's name to look up the localized description etc.
|
Modifier and Type | Method and Description |
---|---|
boolean |
execute(org.bukkit.command.CommandSender sender,
String commandLabel,
String[] args) |
protected abstract boolean |
execute(org.bukkit.command.CommandSender sender,
String commandLabel,
String[] args,
GlowVanillaCommand.CommandMessages localizedMessages)
Executes the command, returning its success.
|
protected static ResourceBundle |
getBundle(org.bukkit.command.CommandSender sender) |
protected static ResourceBundle |
getBundle(GlowPlayer sender) |
protected GlowVanillaCommand.CommandMessages |
readResourceBundle(ResourceBundle bundle) |
protected void |
sendUsageMessage(org.bukkit.command.CommandSender sender,
GlowVanillaCommand.CommandMessages commandMessages) |
boolean |
testPermission(org.bukkit.command.CommandSender target,
String permissionMessage)
Works like
Command.testPermission(CommandSender) but uses the specified error message. |
getDouble, getDouble, getInteger, getRelativeDouble, matches
broadcastCommandMessage, broadcastCommandMessage, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getTimingName, getUsage, isRegistered, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, tabComplete, tabComplete, testPermission, testPermissionSilent, toString, unregister
public static final long CACHE_SIZE
public static final String JOINER
public GlowVanillaCommand(@NonNls @NonNls String name)
name
- the command nameprotected GlowVanillaCommand.CommandMessages readResourceBundle(ResourceBundle bundle)
public boolean execute(org.bukkit.command.CommandSender sender, String commandLabel, String[] args)
This delegates to execute(CommandSender, String, String[], CommandMessages)
. If
the command sender is a player, then the description and usage message
are for that player's locale; otherwise, the server locale is used.
execute
in class org.bukkit.command.Command
protected abstract boolean execute(org.bukkit.command.CommandSender sender, String commandLabel, String[] args, GlowVanillaCommand.CommandMessages localizedMessages)
sender
- Source object which is executing this commandcommandLabel
- The alias of the command usedargs
- All arguments passed to the command, split via ' 'localizedMessages
- Object containing the title, description and permission message in
the sender's locale, or set with settersprotected static ResourceBundle getBundle(GlowPlayer sender)
protected static ResourceBundle getBundle(org.bukkit.command.CommandSender sender)
public boolean testPermission(org.bukkit.command.CommandSender target, String permissionMessage)
Command.testPermission(CommandSender)
but uses the specified error message.target
- User to testpermissionMessage
- Error message if user lacks permissionprotected void sendUsageMessage(org.bukkit.command.CommandSender sender, GlowVanillaCommand.CommandMessages commandMessages)
Copyright © 2021. All rights reserved.