Package revxrsal.commands.bungee.core
Class BungeeActor
java.lang.Object
revxrsal.commands.bungee.core.BungeeActor
- All Implemented Interfaces:
BungeeCommandActor
,CommandActor
-
Constructor Summary
ConstructorDescriptionBungeeActor
(net.md_5.bungee.api.CommandSender sender, CommandHandler handler) -
Method Summary
Modifier and TypeMethodDescription@Nullable net.md_5.bungee.api.connection.ProxiedPlayer
asPlayer()
Returns this sender as aProxiedPlayer
.void
Replies to the sender with the specified message, and marks it as an error depending on the platform.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.net.md_5.bungee.api.CommandSender
The underlyingCommandSender
for this subject@NotNull UUID
Returns the unique UID of this subject.boolean
isPlayer()
Returns whether is this sender a player or notvoid
Replies to the sender with the specified message.@NotNull net.md_5.bungee.api.connection.ProxiedPlayer
Requires this sender to be player, otherwise throwsSenderNotPlayerException
.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
-
BungeeActor
-
-
Method Details
-
getSender
public net.md_5.bungee.api.CommandSender getSender()Description copied from interface:BungeeCommandActor
The underlyingCommandSender
for this subject- Specified by:
getSender
in interfaceBungeeCommandActor
- Returns:
- The underlying sender
-
isPlayer
public boolean isPlayer()Description copied from interface:BungeeCommandActor
Returns whether is this sender a player or not- Specified by:
isPlayer
in interfaceBungeeCommandActor
- Returns:
- Whether is that sender a player or not
-
asPlayer
@Nullable public @Nullable net.md_5.bungee.api.connection.ProxiedPlayer asPlayer()Description copied from interface:BungeeCommandActor
Returns this sender as aProxiedPlayer
.- Specified by:
asPlayer
in interfaceBungeeCommandActor
- Returns:
- This sender as a player. Returns null if not a player.
-
requirePlayer
@NotNull public @NotNull net.md_5.bungee.api.connection.ProxiedPlayer requirePlayer() throws SenderNotPlayerExceptionDescription copied from interface:BungeeCommandActor
Requires this sender to be player, otherwise throwsSenderNotPlayerException
.- Specified by:
requirePlayer
in interfaceBungeeCommandActor
- Returns:
- The sender as the player
- Throws:
SenderNotPlayerException
- if the sender is not a player (i.e console)
-
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
-
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
-