Package dev.majek.pc.command
Class PartyCommand
- java.lang.Object
-
- dev.majek.pc.chat.MessageHandler
-
- dev.majek.pc.command.PartyCommand
-
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor,org.bukkit.command.TabCompleter
- Direct Known Subclasses:
PartyAccept,PartyAdd,PartyCreate,PartyDeny,PartyDisband,PartyHelp,PartyInfo,PartyJoin,PartyLeave,PartyPromote,PartyRemove,PartyRename,PartySummon,PartyToggle,PartyVersion
public abstract class PartyCommand extends MessageHandler implements org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter
Handles all /party commands and subcommands.
-
-
Field Summary
Fields Modifier and Type Field Description static Map<org.bukkit.entity.Player,Map<PartyCommand,Cooldown>>cooldownMapMap in a map for cooldown storage.static org.bukkit.configuration.file.FileConfigurationmainConfigPartyChat's main config file.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleananyoneCanUse()booleancanUse(org.bukkit.entity.Player player)Check if a player can use a certain subcommand.abstract booleanexecute(org.bukkit.entity.Player player, String[] args, boolean leftServer)List<String>getAliases()static booleangetConfigBoolean(String path)intgetCooldown()StringgetDescription()StringgetName()static List<String>getSubCommandAliases(String command)static intgetSubCommandCooldown(String command)static StringgetSubCommandDescription(String command)static booleangetSubCommandDisabled(String command)static StringgetSubCommandUsage(String command)StringgetUsage()booleanisDisabled()booleanisEnabled()booleanonCommand(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, @NotNull String[] args)Handle all of the /party command and subcommands.List<String>onTabComplete(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String alias, @NotNull String[] args)Tab completion for /party command and subcommands.static voidreload()Refresh the main PartyChat config object used in this class and subclasses.booleanrequiresLeader()static voidrunTaskLater(int delay, Runnable task)voidsetCooldown(int cooldown)voidsetDisabled(boolean disabled)-
Methods inherited from class dev.majek.pc.chat.MessageHandler
sendFormattedMessage, sendMessage, sendMessage, sendMessageWithEverything, sendMessageWithReplacement, sendMessageWithReplacements
-
-
-
-
Field Detail
-
mainConfig
public static org.bukkit.configuration.file.FileConfiguration mainConfig
PartyChat's main config file.
-
cooldownMap
public static Map<org.bukkit.entity.Player,Map<PartyCommand,Cooldown>> cooldownMap
Map in a map for cooldown storage.
-
-
Method Detail
-
execute
public abstract boolean execute(org.bukkit.entity.Player player, String[] args, boolean leftServer)
-
reload
public static void reload()
Refresh the main PartyChat config object used in this class and subclasses.
-
onCommand
public boolean onCommand(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command, @NotNull @NotNull String label, @NotNull @NotNull String[] args)Handle all of the /party command and subcommands.- Specified by:
onCommandin interfaceorg.bukkit.command.CommandExecutor- Parameters:
sender- The command's sender. In this method we only accept a Player.command- The command itself.label- The command's label.args- The command arguments.- Returns:
- True/False just to make Bukkit happy.
-
onTabComplete
public List<String> onTabComplete(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command, @NotNull @NotNull String alias, @NotNull @NotNull String[] args) throws IllegalArgumentException
Tab completion for /party command and subcommands.- Specified by:
onTabCompletein interfaceorg.bukkit.command.TabCompleter- Parameters:
sender- The command's sender.command- The command itself.alias- The command's alias.args- The command arguments.- Returns:
- A list of strings to show the sender.
- Throws:
IllegalArgumentException- Allows for returningCollections.emptyList().
-
canUse
public boolean canUse(org.bukkit.entity.Player player)
Check if a player can use a certain subcommand. This will check to see if the command requires the player be the party leader, if the command is still on cooldown, and if the command is disabled.- Parameters:
player- The player running the subcommand.- Returns:
- Whether or not the player may use the subcommand.
-
runTaskLater
public static void runTaskLater(int delay, Runnable task)
-
getName
public String getName()
-
getUsage
public String getUsage()
-
getDescription
public String getDescription()
-
requiresLeader
public boolean requiresLeader()
-
anyoneCanUse
public boolean anyoneCanUse()
-
getCooldown
public int getCooldown()
-
setCooldown
public void setCooldown(int cooldown)
-
isDisabled
public boolean isDisabled()
-
isEnabled
public boolean isEnabled()
-
setDisabled
public void setDisabled(boolean disabled)
-
getConfigBoolean
public static boolean getConfigBoolean(String path)
-
getSubCommandDisabled
public static boolean getSubCommandDisabled(String command)
-
getSubCommandCooldown
public static int getSubCommandCooldown(String command)
-
-