add banlist
This commit is contained in:
parent
9ff3aad199
commit
f835beef10
2 changed files with 45 additions and 0 deletions
40
src/command/banlist.rs
Normal file
40
src/command/banlist.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use std::marker::PhantomData;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct BanlistCommand<State> {
|
||||
state: PhantomData<State>
|
||||
}
|
||||
|
||||
pub struct NoFilter;
|
||||
pub struct Ips;
|
||||
pub struct Players;
|
||||
|
||||
impl BanlistCommand<NoFilter> {
|
||||
pub(crate) fn new() -> Self {
|
||||
Self { state: PhantomData }
|
||||
}
|
||||
|
||||
pub fn players(self) -> BanlistCommand<Players> {
|
||||
BanlistCommand { state: PhantomData }
|
||||
}
|
||||
|
||||
pub fn ips(self) -> BanlistCommand<Ips> {
|
||||
BanlistCommand { state: PhantomData }
|
||||
}
|
||||
|
||||
pub fn build(self) -> super::Command {
|
||||
super::Command::raw("banlist")
|
||||
}
|
||||
}
|
||||
|
||||
impl BanlistCommand<Players> {
|
||||
pub fn build(self) -> super::Command {
|
||||
super::Command::raw("banlist players")
|
||||
}
|
||||
}
|
||||
|
||||
impl BanlistCommand<Ips> {
|
||||
pub fn build(self) -> super::Command {
|
||||
super::Command::raw("banlist ips")
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ mod say;
|
|||
mod list;
|
||||
mod kill;
|
||||
mod ban;
|
||||
mod banlist;
|
||||
|
||||
impl Command {
|
||||
pub fn raw(cmd: &str) -> Self {
|
||||
|
|
@ -55,4 +56,8 @@ impl Command {
|
|||
pub fn ban() -> ban::BanCommand {
|
||||
ban::BanCommand::default()
|
||||
}
|
||||
|
||||
pub fn banlist() -> banlist::BanlistCommand<banlist::NoFilter> {
|
||||
banlist::BanlistCommand::new()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue