Add Summon Command

Also refactor some things:

- Remove cmd_ prefix from commands
- Remove arg_ prefix from arguments
This commit is contained in:
Alexander Medvedev
2025-01-26 20:06:20 +01:00
parent 69cb3bb4f0
commit 2fdf0777f6
57 changed files with 351 additions and 196 deletions

View File

@@ -1,8 +1,8 @@
use std::fmt;
use std::sync::Arc;
use crate::command::commands::cmd_seed;
use crate::command::commands::{cmd_bossbar, cmd_transfer};
use crate::command::commands::seed;
use crate::command::commands::{bossbar, transfer};
use crate::command::dispatcher::CommandDispatcher;
use crate::entity::player::Player;
use crate::server::Server;
@@ -10,9 +10,8 @@ use crate::world::World;
use args::ConsumedArgs;
use async_trait::async_trait;
use commands::{
cmd_clear, cmd_deop, cmd_fill, cmd_gamemode, cmd_give, cmd_help, cmd_kick, cmd_kill, cmd_list,
cmd_me, cmd_op, cmd_playsound, cmd_plugin, cmd_plugins, cmd_pumpkin, cmd_say, cmd_setblock,
cmd_stop, cmd_teleport, cmd_time, cmd_title, cmd_worldborder,
clear, deop, fill, gamemode, give, help, kick, kill, list, me, op, playsound, plugin, plugins,
pumpkin, say, setblock, stop, summon, teleport, time, title, worldborder,
};
use dispatcher::CommandError;
use pumpkin_util::math::vector3::Vector3;
@@ -112,31 +111,32 @@ impl CommandSender<'_> {
pub fn default_dispatcher() -> CommandDispatcher {
let mut dispatcher = CommandDispatcher::default();
dispatcher.register(cmd_pumpkin::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(cmd_bossbar::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_say::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_gamemode::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_stop::init_command_tree(), PermissionLvl::Four);
dispatcher.register(cmd_help::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(cmd_kill::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_kick::init_command_tree(), PermissionLvl::Three);
dispatcher.register(cmd_plugin::init_command_tree(), PermissionLvl::Three);
dispatcher.register(cmd_plugins::init_command_tree(), PermissionLvl::Three);
dispatcher.register(cmd_worldborder::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_teleport::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_time::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_give::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_list::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(cmd_clear::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_setblock::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_seed::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_transfer::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(cmd_fill::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_op::init_command_tree(), PermissionLvl::Three);
dispatcher.register(cmd_deop::init_command_tree(), PermissionLvl::Three);
dispatcher.register(cmd_me::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(cmd_playsound::init_command_tree(), PermissionLvl::Two);
dispatcher.register(cmd_title::init_command_tree(), PermissionLvl::Two);
dispatcher.register(pumpkin::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(bossbar::init_command_tree(), PermissionLvl::Two);
dispatcher.register(say::init_command_tree(), PermissionLvl::Two);
dispatcher.register(gamemode::init_command_tree(), PermissionLvl::Two);
dispatcher.register(stop::init_command_tree(), PermissionLvl::Four);
dispatcher.register(help::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(kill::init_command_tree(), PermissionLvl::Two);
dispatcher.register(kick::init_command_tree(), PermissionLvl::Three);
dispatcher.register(plugin::init_command_tree(), PermissionLvl::Three);
dispatcher.register(plugins::init_command_tree(), PermissionLvl::Three);
dispatcher.register(worldborder::init_command_tree(), PermissionLvl::Two);
dispatcher.register(teleport::init_command_tree(), PermissionLvl::Two);
dispatcher.register(time::init_command_tree(), PermissionLvl::Two);
dispatcher.register(give::init_command_tree(), PermissionLvl::Two);
dispatcher.register(list::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(clear::init_command_tree(), PermissionLvl::Two);
dispatcher.register(setblock::init_command_tree(), PermissionLvl::Two);
dispatcher.register(seed::init_command_tree(), PermissionLvl::Two);
dispatcher.register(transfer::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(fill::init_command_tree(), PermissionLvl::Two);
dispatcher.register(op::init_command_tree(), PermissionLvl::Three);
dispatcher.register(deop::init_command_tree(), PermissionLvl::Three);
dispatcher.register(me::init_command_tree(), PermissionLvl::Zero);
dispatcher.register(playsound::init_command_tree(), PermissionLvl::Two);
dispatcher.register(title::init_command_tree(), PermissionLvl::Two);
dispatcher.register(summon::init_command_tree(), PermissionLvl::Two);
dispatcher
}