diff --git a/src/command/deop.rs b/src/command/deop.rs new file mode 100644 index 0000000..5f4eda3 --- /dev/null +++ b/src/command/deop.rs @@ -0,0 +1,17 @@ +#[derive(Default)] +pub struct DeopCommand { + target: Option +} + +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) + } +} \ No newline at end of file diff --git a/src/command/mod.rs b/src/command/mod.rs index 674b0c5..eda185e 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -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() + } } \ No newline at end of file diff --git a/src/command/op.rs b/src/command/op.rs new file mode 100644 index 0000000..af05c56 --- /dev/null +++ b/src/command/op.rs @@ -0,0 +1,17 @@ +#[derive(Default)] +pub struct OpCommand { + target: Option +} + +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) + } +} \ No newline at end of file