Files
Pumpkin/pumpkin/src/plugin/api/events/player/player_command_send.rs
Epix 93510eecd5 Grammar fixes, terminology change (#633)
* Major grammar sweep

* Remove extra backtick

* Use more specific terminology for chunk data storage

* Forgor to cargofmt

* Fix typo "thier"

* Fix typo "clousures"

* Try new terminology

* Forgor to cargofmt

* Use "Subchunks" instead of "Heterogeneous" for ChunkBlocks variant

* Fix variable name

* Forgor to change comment
2025-03-16 10:40:17 +01:00

46 lines
1.1 KiB
Rust

use pumpkin_macros::{Event, cancellable};
use std::sync::Arc;
use crate::entity::player::Player;
use super::PlayerEvent;
/// An event that occurs when a player executes a command
///
/// If the event is cancelled, the command will not be executed.
///
/// This event contains information about the player and the command being executed.
#[cancellable]
#[derive(Event, Clone)]
pub struct PlayerCommandSendEvent {
/// The player who is executing the command.
pub player: Arc<Player>,
/// The command being executed
pub command: String,
}
impl PlayerCommandSendEvent {
/// Creates a new instance of `PlayerCommandSendEvent`.
///
/// # Arguments
/// - `player`: A reference to the player running the command.
/// - `command`: The command being executed.
///
/// # Returns
/// A new instance of `PlayerCommandSendEvent`.
pub fn new(player: Arc<Player>, command: String) -> Self {
Self {
player,
command,
cancelled: false,
}
}
}
impl PlayerEvent for PlayerCommandSendEvent {
fn get_player(&self) -> &Arc<Player> {
&self.player
}
}