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:
AdminCMD
,AdminworldCMD
,AdventureCMD
,BanCMD
,CommandSpyCMD
,CreativeCMD
,DeopAllCMD
,DeopCMD
,FlatlandsCMD
,FreezeCMD
,ListCMD
,LocalSpawnCMD
,MasterbuilderworldCMD
,NameHistoryCMD
,OpAllCMD
,OpCMD
,PlexCMD
,PunishmentsCMD
,RankCMD
,SpectatorCMD
,SurvivalCMD
,UnbanCMD
,WorldCMD
public abstract class PlexCommand
extends org.bukkit.command.Command
implements org.bukkit.command.PluginIdentifiableCommand
Superclass for all commands
-
Field Summary
Modifier and TypeFieldDescriptionprivate final RequiredCommandSource
Required command source fetched from the permissionsprivate final Rank
Minimum required rank fetched from the permissionsprivate final CommandParameters
The parameters for the commandprivate final CommandPermissions
The permissions for the commandprotected static Plex
Returns the instance of the pluginFields inherited from class org.bukkit.command.Command
description, timings, usageMessage
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Checks whether a sender has enough permissions or is high enough a rankprotected boolean
Checks whether a player has enough permissions or is high enough a rankprotected net.kyori.adventure.text.Component
Converts a string to a legacy kyori componentprotected abstract net.kyori.adventure.text.Component
execute
(@NotNull org.bukkit.command.CommandSender sender, @Nullable org.bukkit.entity.Player playerSender, @NotNull String[] args) Executes the commandgetLevel()
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
The pluginprotected UUID
getUUID
(org.bukkit.command.CommandSender sender) Gets the UUID of the senderprotected boolean
isAdmin
(PlexPlayer plexPlayer) Checks if a player is an adminprotected boolean
Checks if a username is an adminprotected boolean
isAdmin
(org.bukkit.command.CommandSender sender) Checks if a sender is an adminprotected boolean
isConsole
(org.bukkit.command.CommandSender sender) Checks whether a sender is consoleprotected boolean
isSeniorAdmin
(org.bukkit.command.CommandSender sender) Checks if a sender is a senior adminprivate boolean
Checks if the string given is a command stringprotected void
Sends a message to an audienceprotected void
send
(net.kyori.adventure.audience.Audience audience, net.kyori.adventure.text.Component component) Sends a message to an audienceprotected net.kyori.adventure.text.Component
Converts a message entry from the "messages.yml" to a componentprotected net.kyori.adventure.text.Component
Converts usage to a componentMethods inherited from class org.bukkit.command.Command
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
-
Field Details
-
plugin
Returns the instance of the plugin -
params
The parameters for the command -
perms
The permissions for the command -
level
Minimum required rank fetched from the permissions -
commandSource
Required command source fetched from the permissions
-
-
Constructor Details
-
PlexCommand
public PlexCommand()Creates an instance of the command
-
-
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 commandplayerSender
- The player who executed the command (null if command source is console or if command source is any but console executed)args
- A Kyori Component to send to the sender (can be null)- Returns:
-
matches
Checks if the string given is a command string- Parameters:
label
- The string to check- Returns:
- true if the string is a command name or alias
-
getPlexPlayer
Gets a PlexPlayer from Player object- Parameters:
player
- The player object- Returns:
- PlexPlayer Object
- See Also:
-
send
Sends a message to an audience- Parameters:
audience
- The audience to send the message tos
- 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 tocomponent
- The component to send
-
checkRank
Checks whether a sender has enough permissions or is high enough a rank- Parameters:
sender
- A command senderrank
- 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:
-
checkRank
Checks whether a player has enough permissions or is high enough a rank- Parameters:
player
- The player objectrank
- 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:
-
isAdmin
Checks if a player is an admin- Parameters:
plexPlayer
- The PlexPlayer object- Returns:
- true if the player is an admin
- See Also:
-
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
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
Gets the UUID of the sender- Parameters:
sender
- A command sender- Returns:
- A unique ID or null if the sender is console
- See Also:
-
getPlugin
The plugin- Specified by:
getPlugin
in interfaceorg.bukkit.command.PluginIdentifiableCommand
- Returns:
- The instance of the plugin
- See Also:
-
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
-
tl
Converts a message entry from the "messages.yml" to a component- Parameters:
s
- The message entryobjects
- Any objects to replace in order- Returns:
- A kyori component
-
usage
Converts usage to a component- Parameters:
s
- The usage to convert- Returns:
- A kyori component stating the usage
-
getNonNullPlayer
-
getOnlinePlexPlayer
-
getOfflinePlexPlayer
-
getNonNullWorld
-
componentFromString
Converts a string to a legacy kyori component- Parameters:
s
- The string to convert- Returns:
- A kyori component
-
getLevel
-
getMap
public org.bukkit.command.CommandMap getMap()
-