Package net.glowstone.command.minecraft
Class GlowVanillaCommand
java.lang.Object
org.bukkit.command.Command
org.bukkit.command.defaults.VanillaCommand
net.glowstone.command.minecraft.GlowVanillaCommand
- Direct Known Subclasses:
BanCommand
,BanIpCommand
,BanListCommand
,ClearCommand
,CloneCommand
,ColorCommand
,DefaultGameModeCommand
,DeopCommand
,DifficultyCommand
,EffectCommand
,EnchantCommand
,FunctionCommand
,GameModeCommand
,GameRuleCommand
,GiveCommand
,GlowstoneCommand
,KickCommand
,KillCommand
,ListCommand
,MeCommand
,OpCommand
,PardonCommand
,PardonIpCommand
,PlaySoundCommand
,SaveAllCommand
,SaveToggleCommand
,SayCommand
,SeedCommand
,SetBlockCommand
,SetIdleTimeoutCommand
,SetWorldSpawnCommand
,SpawnPointCommand
,StopCommand
,SummonCommand
,TeleportCommand
,TellCommand
,TellrawCommand
,TestForBlockCommand
,TestForBlocksCommand
,TestForCommand
,TimeCommand
,TitleCommand
,ToggleDownfallCommand
,TpCommand
,WeatherCommand
,WhitelistCommand
,WorldBorderCommand
,XpCommand
public abstract class GlowVanillaCommand
extends org.bukkit.command.defaults.VanillaCommand
A subclass of
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.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
static enum
Keys for localizable messages shared by more than one command. -
Field Summary
Fields inherited from class org.bukkit.command.Command
description, timings, usageMessage
-
Constructor Summary
ConstructorDescriptionGlowVanillaCommand
(@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. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
(GlowPlayer sender) protected static ResourceBundle
getBundle
(org.bukkit.command.CommandSender 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 likeCommand.testPermission(CommandSender)
but uses the specified error message.Methods inherited from class org.bukkit.command.defaults.VanillaCommand
getDouble, getDouble, getInteger, getRelativeDouble, matches
Methods inherited from class org.bukkit.command.Command
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
-
Field Details
-
CACHE_SIZE
public static final long CACHE_SIZE- See Also:
-
JOINER
- See Also:
-
-
Constructor Details
-
GlowVanillaCommand
Creates an instance with no aliases (i.e. only callable by one name), using the name to look up the localized description etc.- Parameters:
name
- the command name
-
GlowVanillaCommand
Creates an instance, using the command's name to look up the localized description etc.- Parameters:
name
- the command namealiases
- synonyms to accept for the command
-
-
Method Details
-
getBundle
-
getBundle
-
readResourceBundle
-
execute
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.- Specified by:
execute
in classorg.bukkit.command.Command
-
execute
protected abstract boolean execute(org.bukkit.command.CommandSender sender, String commandLabel, String[] args, GlowVanillaCommand.CommandMessages localizedMessages) Executes the command, returning its success.- Parameters:
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 setters- Returns:
- true if the command was successful, otherwise false
-
testPermission
Works likeCommand.testPermission(CommandSender)
but uses the specified error message.- Parameters:
target
- User to testpermissionMessage
- Error message if user lacks permission- Returns:
- true if they can use it, otherwise false
-
sendUsageMessage
protected void sendUsageMessage(org.bukkit.command.CommandSender sender, GlowVanillaCommand.CommandMessages commandMessages)
-