implement Display for Selector
This commit is contained in:
parent
398615573c
commit
dbf872baeb
1 changed files with 16 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue