implement Display for Selector

This commit is contained in:
Raptorox 2026-07-28 17:31:37 +02:00
parent 398615573c
commit dbf872baeb
No known key found for this signature in database
GPG key ID: 8B3556FC3ED1F6D8

View file

@ -1,3 +1,5 @@
use std::fmt::Display;
pub struct Command(String);
pub enum Selector {
@ -9,8 +11,22 @@ pub enum Selector {
NearestEntity // @n
}
impl Display for Selector {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::NearestPlayer => write!(f, "@p"),
Self::RandomPlayer => write!(f, "@r"),
Self::AllPlayers => write!(f, "@a"),
Self::AllEntities => write!(f, "@e"),
Self::Executor => write!(f, "@s"),
Self::NearestEntity => write!(f, "@n")
}
}
}
mod say;
mod list;
mod kill;
impl Command {
pub fn raw(cmd: &str) -> Self {