# Command Event

The command event is passed through the callback function of the [plugin.addCommand()](/globals/global-variables/plugin.md) method. This event has certain properties that can help you when creating the function of your command. This even is known as `commandEvent` in the [examples](/commands/examples.md). Look there to see how it is used.

* **`commandEvent.isPlayerSender()`: boolean**\
  Returns true if the sender of the command is a player or false otherwise.
* **`commandEvent.isConsoleSender()`: boolean**\
  Returns true if the sender of the command is the console or false otherwise.
* **`commandEvent.isBlockSender()`: boolean**\
  Returns true if the sender of the command is a block (e.g. command block) or false otherwise.
* **`commandEvent.isEntitySender()`: boolean**\
  Returns true if the sender of the command is an entity (can be a player) or false otherwise.
* **`commandEvent.getSender()`:** [**org.bukkit.command.CommandSender**](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/command/CommandSender.html)\
  Returns the sender of the command.
* **`commandEvent.getArgs()`: array**\
  Returns the arguments of the command.
* **`commandEvent.getCommand()`: string**\
  Returns the name of the command.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lukkit.net/commands/command-event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
