Interface VelocityCommandActor

All Superinterfaces:
CommandActor
All Known Implementing Classes:
VelocityActor

public interface VelocityCommandActor extends CommandActor
Represents a Velocity CommandActor that wraps a CommandSource
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable com.velocitypowered.api.proxy.Player
    Returns this actor as a Player if it is a player, otherwise returns null.
    @NotNull com.velocitypowered.api.proxy.ProxyServer
    Returns the ProxyServer of this actor
    @NotNull com.velocitypowered.api.command.CommandSource
    Returns the underlying CommandSource being wrapped by this actor.
    boolean
    Tests whether is this actor the console or not
    boolean
    Tests whether is this actor a player or not
    void
    reply(@NotNull net.kyori.adventure.text.Component component)
    Sends the given component message to this actor
    void
    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 a ConsoleCommandSource if it is a player, otherwise throws a SenderNotConsoleException.
    @NotNull com.velocitypowered.api.proxy.Player
    Returns this actor as a Player if it is a player, otherwise throws a SenderNotPlayerException.
    static @NotNull VelocityCommandActor
    wrap(@NotNull com.velocitypowered.api.command.CommandSource source, @NotNull com.velocitypowered.api.proxy.ProxyServer proxyServer, @NotNull CommandHandler handler)
    Creates a new VelocityCommandActor that wraps the given CommandSource.

    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 underlying CommandSource 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 the ProxyServer 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 a Player if it is a player, otherwise returns null.
      Returns:
      The sender as a player, or null.
    • requirePlayer

      @NotNull @NotNull com.velocitypowered.api.proxy.Player requirePlayer() throws SenderNotPlayerException
      Returns this actor as a Player if it is a player, otherwise throws a SenderNotPlayerException.
      Returns:
      The actor as a player
      Throws:
      SenderNotPlayerException - if not a player
    • requireConsole

      @NotNull @NotNull com.velocitypowered.api.proxy.ConsoleCommandSource requireConsole() throws SenderNotConsoleException
      Returns this actor as a ConsoleCommandSource if it is a player, otherwise throws a SenderNotConsoleException.
      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 new VelocityCommandActor that wraps the given CommandSource.
      Parameters:
      source - Command source to wrap
      proxyServer - The injected proxy server
      Returns:
      The wrapping VelocityCommandActor.