Skip to content

Commit

Permalink
Fix merge related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vyPal committed Dec 27, 2024
1 parent 5654002 commit 4b31468
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
18 changes: 8 additions & 10 deletions plugins/hello-plugin-source/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use pumpkin_core::text::color::NamedColor;
use pumpkin_core::text::TextComponent;
use serde::{Deserialize, Serialize};
use std::fs;
use tokio::runtime::Handle;

#[derive(Serialize, Deserialize, Debug)]
struct Config {
Expand Down Expand Up @@ -61,7 +60,6 @@ impl CommandExecutor for SetblockExecutor {
_server: &Server,
args: &ConsumedArgs<'a>,
) -> Result<(), CommandError> {
log::error!("Runtime is {:?}", Handle::current());
let block = BlockArgumentConsumer::find_arg(args, ARG_BLOCK)?;
let block_state_id = block.default_state_id;
let pos = BlockPosArgumentConsumer::find_arg(args, ARG_BLOCK_POS)?;
Expand Down Expand Up @@ -102,18 +100,18 @@ impl CommandExecutor for SetblockExecutor {
}
}

pub fn init_command_tree<'a>() -> CommandTree<'a> {
pub fn init_command_tree() -> CommandTree {
CommandTree::new(NAMES, DESCRIPTION).with_child(
require(&|sender| {
require(|sender| {
sender.has_permission_lvl(PermissionLvl::Two) && sender.world().is_some()
})
.with_child(
argument(ARG_BLOCK_POS, &BlockPosArgumentConsumer).with_child(
argument(ARG_BLOCK, &BlockArgumentConsumer)
.with_child(literal("replace").execute(&SetblockExecutor(Mode::Replace)))
.with_child(literal("destroy").execute(&SetblockExecutor(Mode::Destroy)))
.with_child(literal("keep").execute(&SetblockExecutor(Mode::Keep)))
.execute(&SetblockExecutor(Mode::Replace)),
argument(ARG_BLOCK_POS, BlockPosArgumentConsumer).with_child(
argument(ARG_BLOCK, BlockArgumentConsumer)
.with_child(literal("replace").execute(SetblockExecutor(Mode::Replace)))
.with_child(literal("destroy").execute(SetblockExecutor(Mode::Destroy)))
.with_child(literal("keep").execute(SetblockExecutor(Mode::Keep)))
.execute(SetblockExecutor(Mode::Replace)),
),
),
)
Expand Down
10 changes: 5 additions & 5 deletions pumpkin/src/command/commands/cmd_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,17 @@ impl CommandExecutor for UnloadExecutor {
}
}

pub fn init_command_tree<'a>() -> CommandTree<'a> {
pub fn init_command_tree() -> CommandTree {
CommandTree::new(NAMES, DESCRIPTION).with_child(
require(&|sender| sender.has_permission_lvl(PermissionLvl::Three))
require(|sender| sender.has_permission_lvl(PermissionLvl::Three))
.with_child(
literal("load")
.with_child(argument(PLUGIN_NAME, &SimpleArgConsumer).execute(&LoadExecutor)),
.with_child(argument(PLUGIN_NAME, SimpleArgConsumer).execute(LoadExecutor)),
)
.with_child(
literal("unload")
.with_child(argument(PLUGIN_NAME, &SimpleArgConsumer).execute(&UnloadExecutor)),
.with_child(argument(PLUGIN_NAME, SimpleArgConsumer).execute(UnloadExecutor)),
)
.with_child(literal("list").execute(&ListExecutor)),
.with_child(literal("list").execute(ListExecutor)),
)
}
4 changes: 2 additions & 2 deletions pumpkin/src/command/commands/cmd_plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ impl CommandExecutor for ListExecutor {
}
}

pub fn init_command_tree<'a>() -> CommandTree<'a> {
CommandTree::new(NAMES, DESCRIPTION).execute(&ListExecutor)
pub fn init_command_tree() -> CommandTree {
CommandTree::new(NAMES, DESCRIPTION).execute(ListExecutor)
}
4 changes: 2 additions & 2 deletions pumpkin/src/plugin/api/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Context {
recv.await.unwrap()
}

pub async fn register_command(&self, tree: crate::command::tree::CommandTree<'static>) {
pub async fn register_command(&self, tree: crate::command::tree::CommandTree) {
let _ = self
.channel
.send(ContextAction::RegisterCommand(tree))
Expand All @@ -64,7 +64,7 @@ pub enum ContextAction {
player_name: String,
response: oneshot::Sender<Result<PlayerEvent<'static>, String>>,
},
RegisterCommand(crate::command::tree::CommandTree<'static>),
RegisterCommand(crate::command::tree::CommandTree),
}

pub fn handle_context(
Expand Down

0 comments on commit 4b31468

Please sign in to comment.