CommandAPI 9.3.0
An API for the command UI introduced in Minecraft 1.13
dev.jorel.commandapi.wrappers.NativeProxyCommandSender Class Reference

A simple representation of Minecraft's CommandListenerWrapper, in the form of Bukkit's ProxiedCommandSender. More...

+ Inheritance diagram for dev.jorel.commandapi.wrappers.NativeProxyCommandSender:

Public Member Functions

 NativeProxyCommandSender (CommandSender caller, CommandSender callee, Location location, World world)
 Constructs a NativeProxyCommandSender, which is basically Minecraft's CommandListenerWrapper. More...
 
PermissionAttachment addAttachment (Plugin plugin)
 Adds a new empty PermissionAttachment to this object. More...
 
PermissionAttachment addAttachment (Plugin plugin, int ticks)
 Temporarily adds a new empty PermissionAttachment to this object. More...
 
PermissionAttachment addAttachment (Plugin plugin, String name, boolean value)
 Adds a new PermissionAttachment with a single permission by name and value. More...
 
PermissionAttachment addAttachment (Plugin plugin, String name, boolean value, int ticks)
 Temporarily adds a new PermissionAttachment with a single permission by name and value. More...
 
CommandSender getCallee ()
 Returns the CommandSender which is being used to call the command. More...
 
CommandSender getCaller ()
 Returns the CommandSender which triggered this proxied command. More...
 
Set< PermissionAttachmentInfo > getEffectivePermissions ()
 Gets a set containing all of the permissions currently in effect by this object. More...
 
Location getLocation ()
 Returns the location that this native command sender represents. More...
 
String getName ()
 Gets the name of this command sender. More...
 
Server getServer ()
 Returns the server instance that this command is running on. More...
 
World getWorld ()
 Returns the world that this native command sender represents. More...
 
boolean hasPermission (Permission perm)
 Gets the value of the specified permission, if set. More...
 
boolean hasPermission (String name)
 Gets the value of the specified permission, if set. More...
 
boolean isOp ()
 Checks if this object is a server operator. More...
 
boolean isPermissionSet (Permission perm)
 Checks if this object contains an override for the specified Permission. More...
 
boolean isPermissionSet (String name)
 Checks if this object contains an override for the specified permission, by fully qualified name. More...
 
void recalculatePermissions ()
 Recalculates the permissions for this object, if the attachments have changed values. More...
 
void removeAttachment (PermissionAttachment attachment)
 Removes the given PermissionAttachment from this object. More...
 
void sendMessage (String message)
 Sends this sender a message. More...
 
void sendMessage (String... messages)
 Sends this sender multiple messages. More...
 
void sendMessage (UUID sender, String message)
 Sends this sender a message. More...
 
void sendMessage (UUID sender, String... messages)
 Sends this sender multiple messages. More...
 
void setOp (boolean value)
 Sets the operator status of this object. More...
 
Spigot spigot ()
 Returns a Spigot instance of this object. More...
 
Component name ()
 

Detailed Description

A simple representation of Minecraft's CommandListenerWrapper, in the form of Bukkit's ProxiedCommandSender.

Constructor & Destructor Documentation

◆ NativeProxyCommandSender()

dev.jorel.commandapi.wrappers.NativeProxyCommandSender.NativeProxyCommandSender ( CommandSender  caller,
CommandSender  callee,
Location  location,
World  world 
)

Constructs a NativeProxyCommandSender, which is basically Minecraft's CommandListenerWrapper.

Parameters
callerthe command sender that actually sent the command
calleethe command sender that will be executing the command
locationthe proxied location that the command will be run at
worldthe proxied world that the command will be run in

Member Function Documentation

◆ addAttachment() [1/4]

PermissionAttachment dev.jorel.commandapi.wrappers.NativeProxyCommandSender.addAttachment ( Plugin  plugin)

Adds a new empty PermissionAttachment to this object.

Parameters
pluginPlugin responsible for this attachment, may not be null or disabled
Returns
The PermissionAttachment that was just created

◆ addAttachment() [2/4]

PermissionAttachment dev.jorel.commandapi.wrappers.NativeProxyCommandSender.addAttachment ( Plugin  plugin,
int  ticks 
)

Temporarily adds a new empty PermissionAttachment to this object.

Parameters
pluginPlugin responsible for this attachment, may not be null or disabled
ticksAmount of ticks to automatically remove this attachment after
Returns
The PermissionAttachment that was just created

◆ addAttachment() [3/4]

PermissionAttachment dev.jorel.commandapi.wrappers.NativeProxyCommandSender.addAttachment ( Plugin  plugin,
String  name,
boolean  value 
)

Adds a new PermissionAttachment with a single permission by name and value.

Parameters
pluginPlugin responsible for this attachment, may not be null or disabled
nameName of the permission to attach
valueValue of the permission
Returns
The PermissionAttachment that was just created

◆ addAttachment() [4/4]

PermissionAttachment dev.jorel.commandapi.wrappers.NativeProxyCommandSender.addAttachment ( Plugin  plugin,
String  name,
boolean  value,
int  ticks 
)

Temporarily adds a new PermissionAttachment with a single permission by name and value.

Parameters
pluginPlugin responsible for this attachment, may not be null or disabled
nameName of the permission to attach
valueValue of the permission
ticksAmount of ticks to automatically remove this attachment after
Returns
The PermissionAttachment that was just created

◆ getCallee()

CommandSender dev.jorel.commandapi.wrappers.NativeProxyCommandSender.getCallee ( )

Returns the CommandSender which is being used to call the command.

Returns
the caller which the command is being run as

◆ getCaller()

CommandSender dev.jorel.commandapi.wrappers.NativeProxyCommandSender.getCaller ( )

Returns the CommandSender which triggered this proxied command.

Returns
the caller which triggered the command

◆ getEffectivePermissions()

Set< PermissionAttachmentInfo > dev.jorel.commandapi.wrappers.NativeProxyCommandSender.getEffectivePermissions ( )

Gets a set containing all of the permissions currently in effect by this object.

Returns
Set of currently effective permissions

◆ getLocation()

Location dev.jorel.commandapi.wrappers.NativeProxyCommandSender.getLocation ( )

Returns the location that this native command sender represents.

Returns
the location that this native command sender represents

◆ getName()

String dev.jorel.commandapi.wrappers.NativeProxyCommandSender.getName ( )

Gets the name of this command sender.

Returns
Name of the sender

◆ getServer()

Server dev.jorel.commandapi.wrappers.NativeProxyCommandSender.getServer ( )

Returns the server instance that this command is running on.

Returns
Server instance

◆ getWorld()

World dev.jorel.commandapi.wrappers.NativeProxyCommandSender.getWorld ( )

Returns the world that this native command sender represents.

Returns
the world that this native command sender represents

◆ hasPermission() [1/2]

boolean dev.jorel.commandapi.wrappers.NativeProxyCommandSender.hasPermission ( Permission  perm)

Gets the value of the specified permission, if set.

If a permission override is not set on this object, the default value of the permission will be returned

Parameters
permPermission to get
Returns
Value of the permission

◆ hasPermission() [2/2]

boolean dev.jorel.commandapi.wrappers.NativeProxyCommandSender.hasPermission ( String  name)

Gets the value of the specified permission, if set.

If a permission override is not set on this object, the default value of the permission will be returned.

Parameters
nameName of the permission
Returns
Value of the permission

◆ isOp()

boolean dev.jorel.commandapi.wrappers.NativeProxyCommandSender.isOp ( )

Checks if this object is a server operator.

Returns
true if this is an operator, otherwise false

◆ isPermissionSet() [1/2]

boolean dev.jorel.commandapi.wrappers.NativeProxyCommandSender.isPermissionSet ( Permission  perm)

Checks if this object contains an override for the specified Permission.

Parameters
permPermission to check
Returns
true if the permission is set, otherwise false

◆ isPermissionSet() [2/2]

boolean dev.jorel.commandapi.wrappers.NativeProxyCommandSender.isPermissionSet ( String  name)

Checks if this object contains an override for the specified permission, by fully qualified name.

Parameters
nameName of the permission
Returns
true if the permission is set, otherwise false

◆ recalculatePermissions()

void dev.jorel.commandapi.wrappers.NativeProxyCommandSender.recalculatePermissions ( )

Recalculates the permissions for this object, if the attachments have changed values.

This should very rarely need to be called from a plugin.

◆ removeAttachment()

void dev.jorel.commandapi.wrappers.NativeProxyCommandSender.removeAttachment ( PermissionAttachment  attachment)

Removes the given PermissionAttachment from this object.

Parameters
attachmentAttachment to remove
Exceptions
IllegalArgumentExceptionThrown when the specified attachment isn't part of this object

◆ sendMessage() [1/4]

void dev.jorel.commandapi.wrappers.NativeProxyCommandSender.sendMessage ( String  message)

Sends this sender a message.

Parameters
messageMessage to be displayed

◆ sendMessage() [2/4]

void dev.jorel.commandapi.wrappers.NativeProxyCommandSender.sendMessage ( String...  messages)

Sends this sender multiple messages.

Parameters
messagesAn array of messages to be displayed

◆ sendMessage() [3/4]

void dev.jorel.commandapi.wrappers.NativeProxyCommandSender.sendMessage ( UUID  sender,
String  message 
)

Sends this sender a message.

Parameters
messageMessage to be displayed
senderThe sender of this message

◆ sendMessage() [4/4]

void dev.jorel.commandapi.wrappers.NativeProxyCommandSender.sendMessage ( UUID  sender,
String...  messages 
)

Sends this sender multiple messages.

Parameters
messagesAn array of messages to be displayed
senderThe sender of this message

◆ setOp()

void dev.jorel.commandapi.wrappers.NativeProxyCommandSender.setOp ( boolean  value)

Sets the operator status of this object.

Parameters
valueNew operator value

◆ spigot()

Spigot dev.jorel.commandapi.wrappers.NativeProxyCommandSender.spigot ( )

Returns a Spigot instance of this object.

Returns
a Spigot instance of this object