add banlist

This commit is contained in:
Raptorox 2026-08-01 14:20:49 +02:00
parent 9ff3aad199
commit f835beef10
No known key found for this signature in database
GPG key ID: 8B3556FC3ED1F6D8
2 changed files with 45 additions and 0 deletions

40
src/command/banlist.rs Normal file
View 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")
}
}

View file

@ -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()
}
}