Package revxrsal.commands.sponge
Interface SpongeCommandActor
- All Superinterfaces:
CommandActor
- All Known Implementing Classes:
SpongeActor
Represents a Sponge
CommandActor
that wraps a CommandSource
-
Method Summary
Modifier and TypeMethodDescription@Nullable org.spongepowered.api.entity.living.player.Player
Returns this actor as aPlayer
if it is a player, otherwise returnsnull
.@NotNull org.spongepowered.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 org.spongepowered.api.text.Text message) Sends a message to this receiver.@NotNull org.spongepowered.api.command.source.ConsoleSource
Returns this actor as aConsoleSource
if it is a player, otherwise throws aSenderNotConsoleException
.@NotNull org.spongepowered.api.entity.living.player.Player
Returns this actor as aPlayer
if it is a player, otherwise throws aSenderNotPlayerException
.static @NotNull SpongeCommandActor
wrap
(@NotNull org.spongepowered.api.command.CommandSource source, @NotNull CommandHandler handler) Creates a newSpongeCommandActor
that wraps the givenCommandSource
.Methods inherited from interface revxrsal.commands.command.CommandActor
as, error, errorLocalized, getCommandHandler, getLocale, getName, getTranslator, getUniqueId, reply, replyLocalized
-
Method Details
-
reply
void reply(@NotNull @NotNull org.spongepowered.api.text.Text message) Sends a message to this receiver.If text formatting is not supported in the implementation it will be displayed as plain text.
- Parameters:
message
- The message
-
getSource
@NotNull @NotNull org.spongepowered.api.command.CommandSource getSource()Returns the underlyingCommandSource
being wrapped by this actor.- Returns:
- Velocity's command source.
-
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 org.spongepowered.api.entity.living.player.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 org.spongepowered.api.entity.living.player.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 org.spongepowered.api.command.source.ConsoleSource requireConsole() throws SenderNotConsoleExceptionReturns this actor as aConsoleSource
if it is a player, otherwise throws aSenderNotConsoleException
.- Returns:
- The actor as console
- Throws:
SenderNotConsoleException
- if not a player
-
wrap
@NotNull static @NotNull SpongeCommandActor wrap(@NotNull @NotNull org.spongepowered.api.command.CommandSource source, @NotNull @NotNull CommandHandler handler) Creates a newSpongeCommandActor
that wraps the givenCommandSource
.- Parameters:
source
- Command source to wrap- Returns:
- The wrapping
SpongeCommandActor
.
-