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
,AdminworldCMD
,AdventureCMD
,BanCMD
,BanListCommand
,BcastLoginMessageCMD
,BlockEditCMD
,CommandSpyCMD
,ConsoleSayCMD
,CreativeCMD
,DebugCMD
,EntityWipeCMD
,FlatlandsCMD
,FreezeCMD
,GamemodeCMD
,KickCMD
,ListCMD
,LocalSpawnCMD
,LockupCMD
,MasterbuilderworldCMD
,MobLimitCMD
,MobPurgeCMD
,MuteCMD
,NotesCMD
,PlexCMD
,PunishmentsCMD
,RawSayCMD
,RemoveLoginMessageCMD
,SayCMD
,SetLoginMessageCMD
,SmiteCMD
,SpectatorCMD
,SurvivalCMD
,TagCMD
,TempbanCMD
,TempmuteCMD
,ToggleCMD
,UnbanCMD
,UnfreezeCMD
,UnmuteCMD
,WhoHasCMD
,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 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
checkPermission
(org.bukkit.command.CommandSender sender, String permission) Checks whether a sender has enough permissions or is high enough a rankprotected boolean
checkPermission
(org.bukkit.entity.Player player, String permission) 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 commandorg.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
isConsole
(org.bukkit.command.CommandSender sender) Checks whether a sender is consoleprivate boolean
Checks if the String given is a matching commandprotected net.kyori.adventure.text.Component
messageComponent
(String s, Object... objects) Converts a message entry from the "messages.yml" to a Componentprotected net.kyori.adventure.text.Component
messageComponent
(String s, net.kyori.adventure.text.Component... objects) Converts a message entry from the "messages.yml" to a Componentprotected String
messageString
(String s, Object... objects) Converts a message entry from the "messages.yml" to a Stringprotected net.kyori.adventure.text.Component
Converts a String to a MiniMessage Componentprotected net.kyori.adventure.text.Component
protected 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 boolean
silentCheckPermission
(org.bukkit.command.CommandSender sender, String permission) Checks whether a sender has enough permissions or is high enough a rankprotected boolean
silentCheckPermission
(org.bukkit.entity.Player player, String permission) smartTabComplete
(@NotNull org.bukkit.command.CommandSender sender, @NotNull String alias, @NotNull String[] args) tabComplete
(@NotNull org.bukkit.command.CommandSender sender, @NotNull String alias, @NotNull String[] args) protected net.kyori.adventure.text.Component
usage()
Converts usage to a Componentprotected net.kyori.adventure.text.Component
Converts usage to a ComponentMethods inherited from class org.bukkit.command.Command
broadcastCommandMessage, broadcastCommandMessage, broadcastCommandMessage, broadcastCommandMessage, canBeOverriden, getAliases, getDescription, getLabel, getName, getPermission, getPermissionMessage, getTimingName, getUsage, isRegistered, permissionMessage, permissionMessage, register, setAliases, setDescription, setLabel, setName, setPermission, setPermissionMessage, setUsage, 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 -
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 commandplayerSender
- 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)
-
smartTabComplete
@NotNull public abstract @NotNull List<String> smartTabComplete(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String alias, @NotNull @NotNull String[] args) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
tabComplete
@NotNull public @NotNull List<String> tabComplete(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull String alias, @NotNull @NotNull String[] args) throws IllegalArgumentException - Overrides:
tabComplete
in classorg.bukkit.command.Command
- Throws:
IllegalArgumentException
-
matches
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
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
-
checkPermission
Checks whether a sender has enough permissions or is high enough a rank- Parameters:
sender
- A CommandSenderpermission
- The permission to check- Returns:
- true if the sender has enough permissions
-
silentCheckPermission
protected boolean silentCheckPermission(org.bukkit.command.CommandSender sender, String permission) Checks whether a sender has enough permissions or is high enough a rank- Parameters:
sender
- A CommandSenderpermission
- The permission to check- Returns:
- true if the sender has enough permissions
-
checkPermission
Checks whether a player has enough permissions or is high enough a rank- Parameters:
player
- The player objectpermission
- The permission to check- Returns:
- true if the sender has enough permissions
-
silentCheckPermission
-
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
-
messageComponent
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
-
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 entryobjects
- Any objects to replace in order- Returns:
- A Kyori Component
-
messageString
Converts a message entry from the "messages.yml" to a String- Parameters:
s
- The message entryobjects
- 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
Converts usage to a Components 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
-
noColorComponentFromString
-
mmString
Converts a String to a MiniMessage Component- Parameters:
s
- The String to convert- Returns:
- A Kyori Component
-
getMap
public org.bukkit.command.CommandMap getMap()
-