Class PlayerCommandEvent

java.lang.Object
net.minestom.server.event.Event
net.minestom.server.event.CancellableEvent
net.minestom.server.event.player.PlayerCommandEvent

public class PlayerCommandEvent
extends CancellableEvent
Called every time a player send a message starting by '/'.
  • Constructor Summary

    Constructors 
    Constructor Description
    PlayerCommandEvent​(Player player, java.lang.String command)  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getCommand()
    Gets the command used (command name + arguments).
    Player getPlayer()
    Gets the player who sent the command.
    void setCommand​(java.lang.String command)
    Changes the command to execute.

    Methods inherited from class net.minestom.server.event.CancellableEvent

    isCancelled, setCancelled

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getPlayer

      @NotNull public Player getPlayer()
      Gets the player who sent the command.
      Returns:
      the player
    • getCommand

      @NotNull public java.lang.String getCommand()
      Gets the command used (command name + arguments).
      Returns:
      the command that the player wants to execute
    • setCommand

      public void setCommand​(@NotNull java.lang.String command)
      Changes the command to execute.
      Parameters:
      command - the new command