Pumpkin/pumpkin/src/commands/cmd_pumpkin.rs
2024-08-20 12:38:54 +02:00

23 lines
755 B
Rust

use pumpkin_text::{color::NamedColor, TextComponent};
use pumpkin_protocol::CURRENT_MC_PROTOCOL;
use crate::server::CURRENT_MC_VERSION;
use crate::commands::tree::CommandTree;
pub(crate) const NAME: &str = "pumpkin";
const DESCRIPTION: &str = "Display information about Pumpkin.";
pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
CommandTree::new(DESCRIPTION).execute(&|sender, _| {
let version = env!("CARGO_PKG_VERSION");
let description = env!("CARGO_PKG_DESCRIPTION");
sender.send_message(TextComponent::text(
&format!("Pumpkin {version}, {description} (Minecraft {CURRENT_MC_VERSION}, Protocol {CURRENT_MC_PROTOCOL})")
).color_named(NamedColor::Green));
Ok(())
})
}