Package revxrsal.commands.velocity
Interface VelocityCommandActor
- All Superinterfaces:
CommandActor
- All Known Implementing Classes:
VelocityActor
Represents a Velocity
CommandActor
that wraps a CommandSource
-
Method Summary
Modifier and TypeMethodDescription@Nullable com.velocitypowered.api.proxy.Player
Returns this actor as aPlayer
if it is a player, otherwise returnsnull
.@NotNull com.velocitypowered.api.proxy.ProxyServer
Returns theProxyServer
of this actor@NotNull com.velocitypowered.api.command.CommandSource
Returns the underlyingCommandSource
being wrapped by this actor.boolean
Tests whether is this actor the console or notboolean
isPlayer()
Tests whether is this actor a player or notvoid
reply
(@NotNull net.kyori.adventure.text.Component component) Sends the given component message to this actorvoid
reply
(@NotNull net.kyori.adventure.text.ComponentLike component) Sends the given component message to this actor@NotNull com.velocitypowered.api.proxy.ConsoleCommandSource
Returns this actor as aConsoleCommandSource
if it is a player, otherwise throws aSenderNotConsoleException
.@NotNull com.velocitypowered.api.proxy.Player
Returns this actor as aPlayer
if it is a player, otherwise throws aSenderNotPlayerException
.static @NotNull VelocityCommandActor
wrap
(@NotNull com.velocitypowered.api.command.CommandSource source, @NotNull com.velocitypowered.api.proxy.ProxyServer proxyServer, @NotNull CommandHandler handler) Creates a newVelocityCommandActor
that wraps the givenCommandSource
.Methods inherited from interface revxrsal.commands.command.CommandActor
as, error, errorLocalized, getCommandHandler, getLocale, getName, getTranslator, getUniqueId, reply, replyLocalized
-
Method Details
-
getSource
@NotNull @NotNull com.velocitypowered.api.command.CommandSource getSource()Returns the underlyingCommandSource
being wrapped by this actor.- Returns:
- Velocity's command source.
-
reply
void reply(@NotNull @NotNull net.kyori.adventure.text.Component component) Sends the given component message to this actor- Parameters:
component
- Component to send
-
reply
void reply(@NotNull @NotNull net.kyori.adventure.text.ComponentLike component) Sends the given component message to this actor- Parameters:
component
- Component to send
-
getServer
@NotNull @NotNull com.velocitypowered.api.proxy.ProxyServer getServer()Returns theProxyServer
of this actor- Returns:
- The proxy server
-
isPlayer
boolean isPlayer()Tests whether is this actor a player or not- Returns:
- Is this a player or not
-
isConsole
boolean isConsole()Tests whether is this actor the console or not- Returns:
- Is this the console or not
-
getAsPlayer
@Nullable @Nullable com.velocitypowered.api.proxy.Player getAsPlayer()Returns this actor as aPlayer
if it is a player, otherwise returnsnull
.- Returns:
- The sender as a player, or null.
-
requirePlayer
@NotNull @NotNull com.velocitypowered.api.proxy.Player requirePlayer() throws SenderNotPlayerExceptionReturns this actor as aPlayer
if it is a player, otherwise throws aSenderNotPlayerException
.- Returns:
- The actor as a player
- Throws:
SenderNotPlayerException
- if not a player
-
requireConsole
@NotNull @NotNull com.velocitypowered.api.proxy.ConsoleCommandSource requireConsole() throws SenderNotConsoleExceptionReturns this actor as aConsoleCommandSource
if it is a player, otherwise throws aSenderNotConsoleException
.- Returns:
- The actor as console
- Throws:
SenderNotConsoleException
- if not a player
-
wrap
@NotNull static @NotNull VelocityCommandActor wrap(@NotNull @NotNull com.velocitypowered.api.command.CommandSource source, @NotNull @NotNull com.velocitypowered.api.proxy.ProxyServer proxyServer, @NotNull @NotNull CommandHandler handler) Creates a newVelocityCommandActor
that wraps the givenCommandSource
.- Parameters:
source
- Command source to wrapproxyServer
- The injected proxy server- Returns:
- The wrapping
VelocityCommandActor
.
-