diff --git a/src/command/mod.rs b/src/command/mod.rs index fbed955..20a4275 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -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 {