add op and deop

This commit is contained in:
Raptorox 2026-08-01 14:45:10 +02:00
parent 4f202c8ade
commit ae432d79e9
No known key found for this signature in database
GPG key ID: 8B3556FC3ED1F6D8
3 changed files with 44 additions and 0 deletions

17
src/command/deop.rs Normal file
View file

@ -0,0 +1,17 @@
#[derive(Default)]
pub struct DeopCommand {
target: Option<super::Selector>
}
impl DeopCommand {
pub fn target(mut self, target: super::Selector) -> Self {
self.target = Some(target);
self
}
pub fn build(self) -> super::Command {
let target = self.target.unwrap_or(super::Selector::Executor);
let s = format!("deop {target}");
super::Command(s)
}
}

View file

@ -50,6 +50,8 @@ mod kill;
mod ban;
mod banlist;
mod defaultgamemode;
mod op;
mod deop;
impl Command {
pub fn raw(cmd: &str) -> Self {
@ -83,4 +85,12 @@ impl Command {
pub fn defaultgamemode() -> defaultgamemode::DefaultGamemodeCommand {
defaultgamemode::DefaultGamemodeCommand::default()
}
pub fn op() -> op::OpCommand {
op::OpCommand::default()
}
pub fn deop() -> deop::DeopCommand {
deop::DeopCommand::default()
}
}

17
src/command/op.rs Normal file
View file

@ -0,0 +1,17 @@
#[derive(Default)]
pub struct OpCommand {
target: Option<super::Selector>
}
impl OpCommand {
pub fn target(mut self, target: super::Selector) -> Self {
self.target = Some(target);
self
}
pub fn build(self) -> super::Command {
let target = self.target.unwrap_or(super::Selector::Executor);
let s = format!("op {target}");
super::Command(s)
}
}