Package revxrsal.commands.sponge.core
Class SpongeActor
java.lang.Object
revxrsal.commands.sponge.core.SpongeActor
- All Implemented Interfaces:
CommandActor
,SpongeCommandActor
-
Constructor Summary
ConstructorDescriptionSpongeActor
(org.spongepowered.api.command.CommandSource source, CommandHandler handler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Replies to the sender with the specified message, and marks it as an error depending on the platform.@Nullable org.spongepowered.api.entity.living.player.Player
Returns this actor as aPlayer
if it is a player, otherwise returnsnull
.Returns the command handler that constructed this actor@NotNull Locale
Returns the locale of this command actor.@NotNull String
getName()
Returns the name of this actor.@NotNull org.spongepowered.api.command.CommandSource
Returns the underlyingCommandSource
being wrapped by this actor.@NotNull UUID
Returns the unique UID of this subject.boolean
Tests whether is this actor the console or notboolean
isPlayer()
Tests whether is this actor a player or notvoid
Replies to the sender with the specified message.void
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
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface revxrsal.commands.command.CommandActor
as, errorLocalized, getTranslator, replyLocalized
-
Constructor Details
-
SpongeActor
-
-
Method Details
-
getName
Description copied from interface:CommandActor
Returns the name of this actor. Varies depending on the platform.- Specified by:
getName
in interfaceCommandActor
- Returns:
- The actor name
-
getUniqueId
Description copied from interface:CommandActor
Returns the unique UID of this subject. Varies depending on the platform.Although some platforms explicitly have their underlying senders have UUIDs, some platforms may have to generate this UUID based on other available data.
- Specified by:
getUniqueId
in interfaceCommandActor
- Returns:
- The UUID of this subject.
-
reply
Description copied from interface:CommandActor
Replies to the sender with the specified message.Varies depending on the platform.
- Specified by:
reply
in interfaceCommandActor
- Parameters:
message
- Message to reply with.
-
error
Description copied from interface:CommandActor
Replies to the sender with the specified message, and marks it as an error depending on the platform.Note that, in certain platforms where no "error" mode is available, this may effectively be equivilent to calling
CommandActor.reply(String)
.This method should not throw any exceptions.
- Specified by:
error
in interfaceCommandActor
- Parameters:
message
- Message to reply with
-
getCommandHandler
Description copied from interface:CommandActor
Returns the command handler that constructed this actor- Specified by:
getCommandHandler
in interfaceCommandActor
- Returns:
- The command handler
-
getSource
@NotNull public @NotNull org.spongepowered.api.command.CommandSource getSource()Description copied from interface:SpongeCommandActor
Returns the underlyingCommandSource
being wrapped by this actor.- Specified by:
getSource
in interfaceSpongeCommandActor
- Returns:
- Velocity's command source.
-
isPlayer
public boolean isPlayer()Description copied from interface:SpongeCommandActor
Tests whether is this actor a player or not- Specified by:
isPlayer
in interfaceSpongeCommandActor
- Returns:
- Is this a player or not
-
isConsole
public boolean isConsole()Description copied from interface:SpongeCommandActor
Tests whether is this actor the console or not- Specified by:
isConsole
in interfaceSpongeCommandActor
- Returns:
- Is this the console or not
-
getAsPlayer
@Nullable public @Nullable org.spongepowered.api.entity.living.player.Player getAsPlayer()Description copied from interface:SpongeCommandActor
Returns this actor as aPlayer
if it is a player, otherwise returnsnull
.- Specified by:
getAsPlayer
in interfaceSpongeCommandActor
- Returns:
- The sender as a player, or null.
-
requirePlayer
@NotNull public @NotNull org.spongepowered.api.entity.living.player.Player requirePlayer() throws SenderNotPlayerExceptionDescription copied from interface:SpongeCommandActor
Returns this actor as aPlayer
if it is a player, otherwise throws aSenderNotPlayerException
.- Specified by:
requirePlayer
in interfaceSpongeCommandActor
- Returns:
- The actor as a player
- Throws:
SenderNotPlayerException
- if not a player
-
requireConsole
@NotNull public @NotNull org.spongepowered.api.command.source.ConsoleSource requireConsole() throws SenderNotConsoleExceptionDescription copied from interface:SpongeCommandActor
Returns this actor as aConsoleSource
if it is a player, otherwise throws aSenderNotConsoleException
.- Specified by:
requireConsole
in interfaceSpongeCommandActor
- Returns:
- The actor as console
- Throws:
SenderNotConsoleException
- if not a player
-
getLocale
Description copied from interface:CommandActor
Returns the locale of this command actor. This can be used by translation tools to provide specialized messages.Note that platforms that do not support per-actor locales will return a default locale, mostly
Locale.ENGLISH
.- Specified by:
getLocale
in interfaceCommandActor
- Returns:
- The actor's locale
-
reply
public void reply(@NotNull @NotNull org.spongepowered.api.text.Text message) Description copied from interface:SpongeCommandActor
Sends a message to this receiver.If text formatting is not supported in the implementation it will be displayed as plain text.
- Specified by:
reply
in interfaceSpongeCommandActor
- Parameters:
message
- The message
-