Package dev.plex.command

# Class PlexCommand

java.lang.Object
org.bukkit.command.Command
dev.plex.command.PlexCommand

All Implemented Interfaces:
  `org.bukkit.command.PluginIdentifiableCommand`

Direct Known Subclasses:
  `AdminChatCMD`, `AdminCMD`, `AdminworldCMD`, `AdventureCMD`, `BanCMD`, `BlockEditCMD`, `CommandSpyCMD`, `ConsoleSayCMD`, `CreativeCMD`, `DebugCMD`, `DeopAllCMD`, `DeopCMD`, `EntityWipeCMD`, `FlatlandsCMD`, `FreezeCMD`, `GamemodeCMD`, `KickCMD`, `ListCMD`, `LocalSpawnCMD`, `LockupCMD`, `MasterbuilderworldCMD`, `MobPurgeCMD`, `MuteCMD`, `NameHistoryCMD`, `NotesCMD`, `OpAllCMD`, `OpCMD`, `PlexCMD`, `PunishmentsCMD`, `RankCMD`, `RawSayCMD`, `RemoveLoginMessageCMD`, `SayCMD`, `SetLoginMessageCMD`, `SmiteCMD`, `SpectatorCMD`, `SurvivalCMD`, `TagCMD`, `TempbanCMD`, `TFMCMD`, `ToggleCMD`, `UnbanCMD`, `UnfreezeCMD`, `UnmuteCMD`, `WorldCMD`

public abstract class PlexCommand extends org.bukkit.command.Command implements org.bukkit.command.PluginIdentifiableCommand
Superclass for all commands

## Field Summary

Fields
Modifier and Type
Field
Description
`private final RequiredCommandSource`
`commandSource`
Required command source fetched from the permissions
`private final Rank`
`level`
Minimum required rank fetched from the permissions
`private final CommandParameters`
`params`
The parameters for the command
`private final CommandPermissions`
`perms`
The permissions for the command
`protected static Plex`
`plugin`
Returns the instance of the plugin

### Fields inherited from class org.bukkit.command.Command

`description, timings, usageMessage`

## Constructor Summary

Constructors
Constructor
Description
`PlexCommand()`
`PlexCommand(boolean register)`
Creates an instance of the command

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`checkRank(org.bukkit.command.CommandSender sender, Rank rank, String permission)`
Checks whether a sender has enough permissions or is high enough a rank
`protected boolean`
`checkRank(org.bukkit.entity.Player player, Rank rank, String permission)`
Checks whether a player has enough permissions or is high enough a rank
`protected boolean`
`checkTab(org.bukkit.command.CommandSender sender, Rank rank, String permission)`
Checks whether a sender has enough permissions or is high enough a rank
`protected boolean`
`checkTab(org.bukkit.entity.Player player, Rank rank, String permission)`
Checks whether a player has enough permissions or is high enough a rank
`protected net.kyori.adventure.text.Component`
`componentFromString(String s)`
Converts a String to a legacy Kyori Component
`protected abstract net.kyori.adventure.text.Component`
`execute(@NotNull org.bukkit.command.CommandSender sender, @Nullable org.bukkit.entity.Player playerSender, @NotNull String[] args)`
Executes the command
`Rank`
`getLevel()`
`org.bukkit.command.CommandMap`
`getMap()`
`protected org.bukkit.entity.Player`
`getNonNullPlayer(String name)`
`protected org.bukkit.World`
`getNonNullWorld(String name)`
`protected PlexPlayer`
`getOfflinePlexPlayer(UUID uuid)`
`protected PlexPlayer`
`getOnlinePlexPlayer(String name)`
`protected PlexPlayer`
`getPlexPlayer(@NotNull org.bukkit.entity.Player player)`
Gets a PlexPlayer from Player object
`@NotNull Plex`
`getPlugin()`
The plugin
`protected UUID`
`getUUID(org.bukkit.command.CommandSender sender)`
Gets the UUID of the sender
`protected boolean`
`isAdmin(PlexPlayer plexPlayer)`
Checks if a player is an admin
`protected boolean`
`isAdmin(String name)`
Checks if a username is an admin
`protected boolean`
`isAdmin(org.bukkit.command.CommandSender sender)`
Checks if a sender is an admin
`protected boolean`
`isConsole(org.bukkit.command.CommandSender sender)`
Checks whether a sender is console
`protected boolean`
`isSeniorAdmin(org.bukkit.command.CommandSender sender)`
Checks if a sender is a senior admin
`private boolean`
`matches(String label)`
Checks if the String given is a matching command
`protected net.kyori.adventure.text.Component`
`messageComponent(String s, Object... objects)`
Converts a message entry from the "messages.yml" to a Component
`protected net.kyori.adventure.text.Component`
`messageComponent(String s, net.kyori.adventure.text.Component... objects)`
Converts a message entry from the "messages.yml" to a Component
`protected String`
`messageString(String s, Object... objects)`
Converts a message entry from the "messages.yml" to a String
`protected net.kyori.adventure.text.Component`
`mmString(String s)`
Converts a String to a MiniMessage Component
`protected net.kyori.adventure.text.Component`
`noColorComponentFromString(String s)`
`protected void`
`send(net.kyori.adventure.audience.Audience audience, String s)`
Sends a message to an Audience
`protected void`
`send(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component component)`
Sends a message to an Audience
`protected boolean`
`silentCheckRank(org.bukkit.entity.Player player, Rank rank, String permission)`
`protected net.kyori.adventure.text.Component`
`usage()`
Converts usage to a Component
`protected net.kyori.adventure.text.Component`
`usage(String s)`
Converts usage to a Component

### Methods inherited from class org.bukkit.command.Command

`broadcastCommandMessage, broadcastCommandMessage, broadcastCommandMessage, broadcastCommandMessage, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getTimingName, getUsage, isRegistered, permissionMessage, permissionMessage, 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

### plugin

protected static Plex plugin
Returns the instance of the plugin

### params

private final CommandParameters params
The parameters for the command

### perms

private final CommandPermissions perms
The permissions for the command

### level

private final Rank level
Minimum required rank fetched from the permissions

### commandSource

private final RequiredCommandSource commandSource
Required command source fetched from the permissions

## Constructor Details

### PlexCommand

public PlexCommand(boolean register)
Creates an instance of the command

### PlexCommand

public PlexCommand()

## Method Details

### execute

protected abstract net.kyori.adventure.text.Component execute(@NotNull @NotNull org.bukkit.command.CommandSender sender, @Nullable @Nullable org.bukkit.entity.Player playerSender, @NotNull @NotNull String[] args)
Executes the command

Parameters:
  `sender` - The sender of the command
  `playerSender` - The player who executed the command (null if CommandSource is console or if CommandSource is any but console executed)
  `args` - A Kyori Component to send to the sender (can be null)

### matches

private boolean matches(String label)
Checks if the String given is a matching command

Parameters:
  `label` - The String to check
Returns:
  true if the string is a command name or alias

### getPlexPlayer

protected PlexPlayer getPlexPlayer(@NotNull @NotNull org.bukkit.entity.Player player)
Gets a PlexPlayer from Player object

Parameters:
  `player` - The player object
Returns:
  PlexPlayer Object
See Also:
  - `PlexPlayer`

### send

protected void send(net.kyori.adventure.audience.Audience audience, String s)
Sends a message to an Audience

Parameters:
  `audience` - The Audience to send the message to
  `s` - The message to send

### send

protected void send(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component component)
Sends a message to an Audience

Parameters:
  `audience` - The Audience to send the message to
  `component` - The Component to send

### checkRank

protected boolean checkRank(org.bukkit.command.CommandSender sender, Rank rank, String permission)
Checks whether a sender has enough permissions or is high enough a rank

Parameters:
  `sender` - A CommandSender
  `rank` - The rank to check (if the server is using ranks)
  `permission` - The permission to check (if the server is using permissions)
Returns:
  true if the sender has enough permissions
See Also:
  - `Rank`

### checkRank

protected boolean checkRank(org.bukkit.entity.Player player, Rank rank, String permission)
Checks whether a player has enough permissions or is high enough a rank

Parameters:
  `player` - The player object
  `rank` - The rank to check (if the server is using ranks)
  `permission` - The permission to check (if the server is using permissions)
Returns:
  true if the sender has enough permissions
See Also:
  - `Rank`

### silentCheckRank

protected boolean silentCheckRank(org.bukkit.entity.Player player, Rank rank, String permission)

### checkTab

protected boolean checkTab(org.bukkit.command.CommandSender sender, Rank rank, String permission)
Checks whether a sender has enough permissions or is high enough a rank

Parameters:
  `sender` - The player object
  `rank` - The rank to check (if the server is using ranks)
  `permission` - The permission to check (if the server is using permissions)
Returns:
  true if the sender has enough permissions
See Also:
  - `Rank`

### checkTab

protected boolean checkTab(org.bukkit.entity.Player player, Rank rank, String permission)
Checks whether a player has enough permissions or is high enough a rank

Parameters:
  `player` - The player object
  `rank` - The rank to check (if the server is using ranks)
  `permission` - The permission to check (if the server is using permissions)
Returns:
  true if the sender has enough permissions
See Also:
  - `Rank`

### isAdmin

protected boolean isAdmin(PlexPlayer plexPlayer)
Checks if a player is an admin

Parameters:
  `plexPlayer` - The PlexPlayer object
Returns:
  true if the player is an admin
See Also:
  - `PlexPlayer`

### isAdmin

protected boolean isAdmin(org.bukkit.command.CommandSender sender)
Checks if a sender is an admin

Parameters:
  `sender` - A command sender
Returns:
  true if the sender is an admin or if console

### isAdmin

protected boolean isAdmin(String name)
Checks if a username is an admin

Parameters:
  `name` - The username
Returns:
  true if the username is an admin

### isSeniorAdmin

protected boolean isSeniorAdmin(org.bukkit.command.CommandSender sender)
Checks if a sender is a senior admin

Parameters:
  `sender` - A command sender
Returns:
  true if the sender is a senior admin or if console

### getUUID

protected UUID getUUID(org.bukkit.command.CommandSender sender)
Gets the UUID of the sender

Parameters:
  `sender` - A command sender
Returns:
  A unique ID or null if the sender is console
See Also:
  - `UUID`

### getPlugin

@NotNull public @NotNull Plex getPlugin()
The plugin

Specified by:
  `getPlugin` in interface `org.bukkit.command.PluginIdentifiableCommand`
Returns:
  The instance of the plugin
See Also:
  - `Plex`

### isConsole

protected boolean isConsole(org.bukkit.command.CommandSender sender)
Checks whether a sender is console

Parameters:
  `sender` - A command sender
Returns:
  true if the sender is console

### messageComponent

protected net.kyori.adventure.text.Component messageComponent(String s, Object... objects)
Converts a message entry from the "messages.yml" to a Component

Parameters:
  `s` - The message entry
  `objects` - Any objects to replace in order
Returns:
  A Kyori Component

### messageComponent

protected net.kyori.adventure.text.Component messageComponent(String s, net.kyori.adventure.text.Component... objects)
Converts a message entry from the "messages.yml" to a Component

Parameters:
  `s` - The message entry
  `objects` - Any objects to replace in order
Returns:
  A Kyori Component

### messageString

protected String messageString(String s, Object... objects)
Converts a message entry from the "messages.yml" to a String

Parameters:
  `s` - The message entry
  `objects` - Any objects to replace in order
Returns:
  A String

### usage

protected net.kyori.adventure.text.Component usage()
Converts usage to a Component

Returns:
  A Kyori Component stating the usage

### usage

protected net.kyori.adventure.text.Component usage(String s)
Converts usage to a Component

s The usage to convert

Returns:
  A Kyori Component stating the usage

### getNonNullPlayer

protected org.bukkit.entity.Player getNonNullPlayer(String name)

### getOnlinePlexPlayer

protected PlexPlayer getOnlinePlexPlayer(String name)

### getOfflinePlexPlayer

protected PlexPlayer getOfflinePlexPlayer(UUID uuid)

### getNonNullWorld

protected org.bukkit.World getNonNullWorld(String name)

### componentFromString

protected net.kyori.adventure.text.Component componentFromString(String s)
Converts a String to a legacy Kyori Component

Parameters:
  `s` - The String to convert
Returns:
  A Kyori component

### noColorComponentFromString

protected net.kyori.adventure.text.Component noColorComponentFromString(String s)

### mmString

protected net.kyori.adventure.text.Component mmString(String s)
Converts a String to a MiniMessage Component

Parameters:
  `s` - The String to convert
Returns:
  A Kyori Component

### getLevel

public Rank getLevel()

### getMap

public org.bukkit.command.CommandMap getMap()