add op and deop
This commit is contained in:
parent
4f202c8ade
commit
ae432d79e9
3 changed files with 44 additions and 0 deletions
17
src/command/deop.rs
Normal file
17
src/command/deop.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
|
|
@ -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
17
src/command/op.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue