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

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
     
    static enum 
    Keys for localizable messages shared by more than one command.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
    static final String
     

    Fields inherited from class org.bukkit.command.Command

    description, timings, usageMessage
  • Constructor Summary

    Constructors
    Constructor
    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.
  • Method Summary

    Modifier and Type
    Method
    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
     
    protected static ResourceBundle
    getBundle(org.bukkit.command.CommandSender sender)
     
     
    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.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • GlowVanillaCommand

      public GlowVanillaCommand(@NonNls @NonNls String name)
      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

      public GlowVanillaCommand(@NonNls @NonNls String name, @NonNls @NonNls List<String> aliases)
      Creates an instance, using the command's name to look up the localized description etc.
      Parameters:
      name - the command name
      aliases - synonyms to accept for the command
  • Method Details

    • getBundle

      protected static ResourceBundle getBundle(GlowPlayer sender)
    • getBundle

      protected static ResourceBundle getBundle(org.bukkit.command.CommandSender sender)
    • readResourceBundle

      protected GlowVanillaCommand.CommandMessages readResourceBundle(ResourceBundle bundle)
    • execute

      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.

      Specified by:
      execute in class org.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 command
      commandLabel - The alias of the command used
      args - 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

      public boolean testPermission(org.bukkit.command.CommandSender target, String permissionMessage)
      Works like Command.testPermission(CommandSender) but uses the specified error message.
      Parameters:
      target - User to test
      permissionMessage - 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)