Class SpigotCommandSender
java.lang.Object
me.github.simonplays15.betterbansystem.core.player.BaseCommandSender
me.github.simonplays15.betterbansystem.core.player.SpigotCommandSender
- All Implemented Interfaces:
org.bukkit.command.CommandSender,org.bukkit.permissions.Permissible,org.bukkit.permissions.ServerOperator
public class SpigotCommandSender
extends BaseCommandSender
implements org.bukkit.command.CommandSender
SpigotCommandSender is a class that represents a command sender in the Spigot server.
It extends the BaseCommandSender class and implements the CommandSender interface.
It provides methods for sending messages, checking permissions, getting the name of the sender, and
determining the type of sender.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.command.CommandSender
org.bukkit.command.CommandSender.Spigot -
Constructor Summary
ConstructorsConstructorDescriptionSpigotCommandSender(Object base) Constructor for the SpigotCommandSender class.SpigotCommandSender(org.bukkit.command.CommandSender base) SpigotCommandSender is a class that represents a command sender in the Spigot plugin for Bukkit. -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.permissions.PermissionAttachmentaddAttachment(@NotNull org.bukkit.plugin.Plugin plugin) Adds a permission attachment for the specified plugin to this command sender.@Nullable org.bukkit.permissions.PermissionAttachmentaddAttachment(@NotNull org.bukkit.plugin.Plugin plugin, int priority) Adds a permission attachment to this sender for the specified plugin with the given priority.@NotNull org.bukkit.permissions.PermissionAttachmentaddAttachment(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String s, boolean b) Adds a permission attachment to the command sender.@Nullable org.bukkit.permissions.PermissionAttachmentaddAttachment(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String s, boolean b, int i) Adds a permission attachment to this command sender.org.bukkit.command.CommandSendergetBase()Retrieves the base CommandSender associated with this object.@NotNull Set<org.bukkit.permissions.PermissionAttachmentInfo>Retrieves the effective permissions of the command sender.@NotNull StringgetName()Retrieves the name of the command sender.Retrieves the type of the command sender.@NotNull org.bukkit.ServerReturns the server associated with this command sender.booleanhasPermission(@NotNull String s) Checks if the command sender has the specified permission.booleanhasPermission(@NotNull org.bukkit.permissions.Permission permission) Checks if the command sender has the specified permission.booleanisOp()Determines whether the command sender has operator permissions.booleanisPermissionSet(@NotNull String s) Determines whether the command sender has the specified permission.booleanisPermissionSet(@NotNull org.bukkit.permissions.Permission permission) Checks if the command sender has the specified permission.static @NotNull SpigotCommandSenderConverts an object to a SpigotCommandSender.voidRecalculates the permissions of the command sender.voidremoveAttachment(@NotNull org.bukkit.permissions.PermissionAttachment permissionAttachment) Removes a permission attachment from the command sender.voidsendMessage(@NotNull String string) Sends a message to the command sender with the specified string.voidsendMessage(@NotNull String @NotNull ... strings) Sends a message or multiple messages to the command sender.voidsendMessage(@Nullable UUID uuid, @NotNull String s) Sends a message to the specified player identified by their UUID.voidsendMessage(@Nullable UUID uuid, @NotNull String... strings) This method sends a message or multiple messages to the command sender.voidsetOp(boolean b) Sets the op status of the command sender.@NotNull org.bukkit.command.CommandSender.Spigotspigot()Retrieves the Spigot for this command sender.Methods inherited from class me.github.simonplays15.betterbansystem.core.player.BaseCommandSender
isBlock, isConsole, isOther, isPlayer
-
Constructor Details
-
SpigotCommandSender
public SpigotCommandSender(org.bukkit.command.CommandSender base) SpigotCommandSender is a class that represents a command sender in the Spigot plugin for Bukkit. It extends the BaseCommandSender class and provides additional functionality to identify the type of sender. -
SpigotCommandSender
Constructor for the SpigotCommandSender class. Initializes a new instance of the SpigotCommandSender class with the given base object.- Parameters:
base- The base object of type Object, representing the command sender.
-
-
Method Details
-
of
Converts an object to a SpigotCommandSender.- Parameters:
sender- the object to convert- Returns:
- a new instance of SpigotCommandSender
-
getSenderType
Retrieves the type of the command sender.- Specified by:
getSenderTypein classBaseCommandSender- Returns:
- The CommandSenderType representing the type of the command sender.
-
getBase
public org.bukkit.command.CommandSender getBase()Retrieves the base CommandSender associated with this object.- Returns:
- the base CommandSender object
-
sendMessage
Sends a message to the command sender with the specified string. The message is prefixed with the prefix retrieved from BetterBanSystem.- Specified by:
sendMessagein interfaceorg.bukkit.command.CommandSender- Specified by:
sendMessagein classBaseCommandSender- Parameters:
string- the string message to send
-
sendMessage
Sends a message or multiple messages to the command sender.- Specified by:
sendMessagein interfaceorg.bukkit.command.CommandSender- Specified by:
sendMessagein classBaseCommandSender- Parameters:
strings- the messages to be sent to the command sender- Throws:
NullPointerException- ifstringsisnull
-
sendMessage
Sends a message to the specified player identified by their UUID.- Specified by:
sendMessagein interfaceorg.bukkit.command.CommandSender- Specified by:
sendMessagein classBaseCommandSender- Parameters:
uuid- The UUID of the player to send the message to. Can be null if the message is intended for all players.s- The message to send.
-
sendMessage
This method sends a message or multiple messages to the command sender.- Specified by:
sendMessagein interfaceorg.bukkit.command.CommandSender- Specified by:
sendMessagein classBaseCommandSender- Parameters:
uuid- The UUID of the command sender to send the message to. Can be null for console.strings- The messages to be sent to the command sender.
-
getServer
@NotNull public @NotNull org.bukkit.Server getServer()Returns the server associated with this command sender.- Specified by:
getServerin interfaceorg.bukkit.command.CommandSender- Returns:
- The server associated with this command sender.
-
getName
Retrieves the name of the command sender.- Specified by:
getNamein interfaceorg.bukkit.command.CommandSender- Specified by:
getNamein classBaseCommandSender- Returns:
- the name of the command sender
-
spigot
@NotNull public @NotNull org.bukkit.command.CommandSender.Spigot spigot()Retrieves the Spigot for this command sender.- Specified by:
spigotin interfaceorg.bukkit.command.CommandSender- Returns:
- the Spigot for this command sender.
-
isPermissionSet
Determines whether the command sender has the specified permission.- Specified by:
isPermissionSetin interfaceorg.bukkit.permissions.Permissible- Parameters:
s- the permission to check- Returns:
- true if the command sender has the permission, false otherwise
-
isPermissionSet
public boolean isPermissionSet(@NotNull @NotNull org.bukkit.permissions.Permission permission) Checks if the command sender has the specified permission.- Specified by:
isPermissionSetin interfaceorg.bukkit.permissions.Permissible- Parameters:
permission- the permission to check- Returns:
- true if the command sender has the permission, false otherwise
-
hasPermission
Checks if the command sender has the specified permission.- Specified by:
hasPermissionin interfaceorg.bukkit.permissions.Permissible- Specified by:
hasPermissionin classBaseCommandSender- Parameters:
s- the permission to check- Returns:
- true if the command sender has the permission, false otherwise
-
hasPermission
public boolean hasPermission(@NotNull @NotNull org.bukkit.permissions.Permission permission) Checks if the command sender has the specified permission.- Specified by:
hasPermissionin interfaceorg.bukkit.permissions.Permissible- Parameters:
permission- the permission to check- Returns:
- true if the command sender has the permission, false otherwise
-
addAttachment
@NotNull public @NotNull org.bukkit.permissions.PermissionAttachment addAttachment(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String s, boolean b) Adds a permission attachment to the command sender.- Specified by:
addAttachmentin interfaceorg.bukkit.permissions.Permissible- Parameters:
plugin- the plugin that owns the attachments- the permission stringb- the value of the permission- Returns:
- the PermissionAttachment object representing the added attachment
-
addAttachment
@NotNull public @NotNull org.bukkit.permissions.PermissionAttachment addAttachment(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) Adds a permission attachment for the specified plugin to this command sender.- Specified by:
addAttachmentin interfaceorg.bukkit.permissions.Permissible- Parameters:
plugin- the plugin that owns the attachment- Returns:
- the newly created PermissionAttachment
-
addAttachment
@Nullable public @Nullable org.bukkit.permissions.PermissionAttachment addAttachment(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String s, boolean b, int i) Adds a permission attachment to this command sender.- Specified by:
addAttachmentin interfaceorg.bukkit.permissions.Permissible- Parameters:
plugin- the plugin that owns this attachments- the permission stringb- the value of the permissioni- the ticks remaining for the attachment (useful for temporary permissions)- Returns:
- the permission attachment that was added
-
addAttachment
@Nullable public @Nullable org.bukkit.permissions.PermissionAttachment addAttachment(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, int priority) Adds a permission attachment to this sender for the specified plugin with the given priority.- Specified by:
addAttachmentin interfaceorg.bukkit.permissions.Permissible- Parameters:
plugin- The plugin that owns the attachmentpriority- The priority of the attachment- Returns:
- The newly created PermissionAttachment, or null if it was not possible to create one
-
removeAttachment
public void removeAttachment(@NotNull @NotNull org.bukkit.permissions.PermissionAttachment permissionAttachment) Removes a permission attachment from the command sender.- Specified by:
removeAttachmentin interfaceorg.bukkit.permissions.Permissible- Parameters:
permissionAttachment- the permission attachment to remove
-
recalculatePermissions
public void recalculatePermissions()Recalculates the permissions of the command sender.This method delegates the task of recalculating permissions to the
Permissible.recalculatePermissions()method of the base command sender object.- Specified by:
recalculatePermissionsin interfaceorg.bukkit.permissions.Permissible
-
getEffectivePermissions
@NotNull public @NotNull Set<org.bukkit.permissions.PermissionAttachmentInfo> getEffectivePermissions()Retrieves the effective permissions of the command sender.- Specified by:
getEffectivePermissionsin interfaceorg.bukkit.permissions.Permissible- Returns:
- a Set of PermissionAttachmentInfo representing the effective permissions of the command sender
-
isOp
public boolean isOp()Determines whether the command sender has operator permissions.- Specified by:
isOpin interfaceorg.bukkit.permissions.ServerOperator- Returns:
- true if the command sender has operator permissions, false otherwise
-
setOp
public void setOp(boolean b) Sets the op status of the command sender.- Specified by:
setOpin interfaceorg.bukkit.permissions.ServerOperator- Parameters:
b- the op status to set
-