From 9f70b95b9bbe28dc06c8cbbdf3948bfaa1c851dd Mon Sep 17 00:00:00 2001 From: Snowiiii Date: Tue, 29 Oct 2024 22:47:52 +0100 Subject: [PATCH] Split commands into their own Folder Now its much nicer separate from the command base --- docs/developer/networking.md | 6 +++--- .../kotlin/de/snowii/extractor/Extractor.kt | 2 +- pumpkin/src/client/player_packet.rs | 2 +- .../src/{commands => command}/arg_player.rs | 8 ++++---- .../src/{commands => command}/arg_position.rs | 6 +++--- .../src/{commands => command}/arg_simple.rs | 0 .../src/{ => command}/commands/cmd_echest.rs | 12 ++++++------ .../{ => command}/commands/cmd_gamemode.rs | 18 +++++++----------- .../src/{ => command}/commands/cmd_help.rs | 13 +++++-------- .../src/{ => command}/commands/cmd_kick.rs | 17 ++++++++--------- .../src/{ => command}/commands/cmd_kill.rs | 16 +++++++--------- .../src/{ => command}/commands/cmd_pumpkin.rs | 15 +++++++++------ pumpkin/src/{ => command}/commands/cmd_say.rs | 19 ++++++++++--------- .../src/{ => command}/commands/cmd_stop.rs | 13 ++++++------- .../{ => command}/commands/cmd_worldborder.rs | 18 +++++++++--------- pumpkin/src/command/commands/mod.rs | 9 +++++++++ .../src/{commands => command}/dispatcher.rs | 6 +++--- pumpkin/src/{commands => command}/mod.rs | 17 ++++++----------- pumpkin/src/{commands => command}/tree.rs | 2 +- .../src/{commands => command}/tree_builder.rs | 4 ++-- .../src/{commands => command}/tree_format.rs | 2 +- pumpkin/src/main.rs | 4 ++-- pumpkin/src/rcon/mod.rs | 2 +- pumpkin/src/server/mod.rs | 2 +- 24 files changed, 105 insertions(+), 108 deletions(-) rename pumpkin/src/{commands => command}/arg_player.rs (92%) rename pumpkin/src/{commands => command}/arg_position.rs (89%) rename pumpkin/src/{commands => command}/arg_simple.rs (100%) rename pumpkin/src/{ => command}/commands/cmd_echest.rs (83%) rename pumpkin/src/{ => command}/commands/cmd_gamemode.rs (90%) rename pumpkin/src/{ => command}/commands/cmd_help.rs (88%) rename pumpkin/src/{ => command}/commands/cmd_kick.rs (71%) rename pumpkin/src/{ => command}/commands/cmd_kill.rs (72%) rename pumpkin/src/{ => command}/commands/cmd_pumpkin.rs (75%) rename pumpkin/src/{ => command}/commands/cmd_say.rs (84%) rename pumpkin/src/{ => command}/commands/cmd_stop.rs (72%) rename pumpkin/src/{ => command}/commands/cmd_worldborder.rs (98%) create mode 100644 pumpkin/src/command/commands/mod.rs rename pumpkin/src/{commands => command}/dispatcher.rs (96%) rename pumpkin/src/{commands => command}/mod.rs (92%) rename pumpkin/src/{commands => command}/tree.rs (98%) rename pumpkin/src/{commands => command}/tree_builder.rs (97%) rename pumpkin/src/{commands => command}/tree_format.rs (98%) diff --git a/docs/developer/networking.md b/docs/developer/networking.md index ee1d65cb0..ff6717ecd 100644 --- a/docs/developer/networking.md +++ b/docs/developer/networking.md @@ -39,10 +39,10 @@ You can also can see all the information the Packets have, which we can either W #[derive(Serialize)] ``` -2. Next, you have set the packet using the packet macro, This uses the Packet ID from the enum order +2. Next, you have set the packet using the client_packet macro, This uses the Packet ID automatically sets the Packet ID from the JSON packets file ```rust -#[client_packet(ClientboundPlayPackets::Disconnect as i32)] +#[client_packet("play:disconnect")] ``` 3. Now you can create the Struct. @@ -85,7 +85,7 @@ impl CPlayDisconnect { ```rust #[derive(Serialize)] -#[client_packet(ClientboundPlayPackets::Disconnect as i32)] +#[client_packet("play:disconnect")] pub struct CPlayDisconnect { reason: TextComponent, } diff --git a/extractor/src/main/kotlin/de/snowii/extractor/Extractor.kt b/extractor/src/main/kotlin/de/snowii/extractor/Extractor.kt index a33293ef3..5e7848ce4 100644 --- a/extractor/src/main/kotlin/de/snowii/extractor/Extractor.kt +++ b/extractor/src/main/kotlin/de/snowii/extractor/Extractor.kt @@ -18,7 +18,7 @@ import java.nio.file.Paths class Extractor : ModInitializer { - val MOD_ID: String = "valence_extractor" + val MOD_ID: String = "pumpkin_extractor" val LOGGER: Logger = LoggerFactory.getLogger(MOD_ID) override fun onInitialize() { diff --git a/pumpkin/src/client/player_packet.rs b/pumpkin/src/client/player_packet.rs index 845c06cb1..35e4d0719 100644 --- a/pumpkin/src/client/player_packet.rs +++ b/pumpkin/src/client/player_packet.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::{ - commands::CommandSender, + command::CommandSender, entity::player::{ChatMode, Hand, Player}, server::Server, world::player_chunker, diff --git a/pumpkin/src/commands/arg_player.rs b/pumpkin/src/command/arg_player.rs similarity index 92% rename from pumpkin/src/commands/arg_player.rs rename to pumpkin/src/command/arg_player.rs index f842a44fd..bc0a7b652 100644 --- a/pumpkin/src/commands/arg_player.rs +++ b/pumpkin/src/command/arg_player.rs @@ -2,10 +2,10 @@ use std::sync::Arc; use async_trait::async_trait; -use crate::commands::dispatcher::InvalidTreeError; -use crate::commands::dispatcher::InvalidTreeError::InvalidConsumptionError; -use crate::commands::tree::{ConsumedArgs, RawArgs}; -use crate::commands::CommandSender; +use crate::command::dispatcher::InvalidTreeError; +use crate::command::dispatcher::InvalidTreeError::InvalidConsumptionError; +use crate::command::tree::{ConsumedArgs, RawArgs}; +use crate::command::CommandSender; use crate::server::Server; use super::tree::ArgumentConsumer; diff --git a/pumpkin/src/commands/arg_position.rs b/pumpkin/src/command/arg_position.rs similarity index 89% rename from pumpkin/src/commands/arg_position.rs rename to pumpkin/src/command/arg_position.rs index 98431f1b8..89b9a4af2 100644 --- a/pumpkin/src/commands/arg_position.rs +++ b/pumpkin/src/command/arg_position.rs @@ -1,8 +1,8 @@ use async_trait::async_trait; -use crate::commands::dispatcher::InvalidTreeError; -use crate::commands::tree::{ConsumedArgs, RawArgs}; -use crate::commands::CommandSender; +use crate::command::dispatcher::InvalidTreeError; +use crate::command::tree::{ConsumedArgs, RawArgs}; +use crate::command::CommandSender; use crate::server::Server; use super::tree::ArgumentConsumer; diff --git a/pumpkin/src/commands/arg_simple.rs b/pumpkin/src/command/arg_simple.rs similarity index 100% rename from pumpkin/src/commands/arg_simple.rs rename to pumpkin/src/command/arg_simple.rs diff --git a/pumpkin/src/commands/cmd_echest.rs b/pumpkin/src/command/commands/cmd_echest.rs similarity index 83% rename from pumpkin/src/commands/cmd_echest.rs rename to pumpkin/src/command/commands/cmd_echest.rs index 6f6743628..625f0610d 100644 --- a/pumpkin/src/commands/cmd_echest.rs +++ b/pumpkin/src/command/commands/cmd_echest.rs @@ -1,9 +1,9 @@ use async_trait::async_trait; use pumpkin_inventory::OpenContainer; -use crate::commands::tree::CommandTree; - -use super::CommandExecutor; +use crate::command::{ + tree::CommandTree, tree::ConsumedArgs, CommandExecutor, CommandSender, InvalidTreeError, +}; const NAMES: [&str; 2] = ["echest", "enderchest"]; @@ -16,10 +16,10 @@ struct EchestExecutor {} impl CommandExecutor for EchestExecutor { async fn execute<'a>( &self, - sender: &mut super::CommandSender<'a>, + sender: &mut CommandSender<'a>, server: &crate::server::Server, - _args: &super::tree::ConsumedArgs<'a>, - ) -> Result<(), super::dispatcher::InvalidTreeError> { + _args: &ConsumedArgs<'a>, + ) -> Result<(), InvalidTreeError> { if let Some(player) = sender.as_player() { let entity_id = player.entity_id(); player.open_container.store(Some(0)); diff --git a/pumpkin/src/commands/cmd_gamemode.rs b/pumpkin/src/command/commands/cmd_gamemode.rs similarity index 90% rename from pumpkin/src/commands/cmd_gamemode.rs rename to pumpkin/src/command/commands/cmd_gamemode.rs index dd709a73a..3825ec044 100644 --- a/pumpkin/src/commands/cmd_gamemode.rs +++ b/pumpkin/src/command/commands/cmd_gamemode.rs @@ -6,22 +6,18 @@ use pumpkin_core::GameMode; use crate::TextComponent; -use crate::commands::arg_player::parse_arg_player; +use crate::command::arg_player::{parse_arg_player, PlayerArgumentConsumer}; -use crate::commands::dispatcher::InvalidTreeError; -use crate::commands::dispatcher::InvalidTreeError::{ +use crate::command::dispatcher::InvalidTreeError; +use crate::command::dispatcher::InvalidTreeError::{ InvalidConsumptionError, InvalidRequirementError, }; -use crate::commands::tree::{CommandTree, ConsumedArgs, RawArgs}; -use crate::commands::tree_builder::{argument, require}; -use crate::commands::CommandSender; -use crate::commands::CommandSender::Player; +use crate::command::tree::{ArgumentConsumer, CommandTree, ConsumedArgs, RawArgs}; +use crate::command::tree_builder::{argument, require}; +use crate::command::CommandSender::Player; +use crate::command::{CommandExecutor, CommandSender}; use crate::server::Server; -use super::arg_player::PlayerArgumentConsumer; -use super::tree::ArgumentConsumer; -use super::CommandExecutor; - const NAMES: [&str; 1] = ["gamemode"]; const DESCRIPTION: &str = "Change a player's gamemode."; diff --git a/pumpkin/src/commands/cmd_help.rs b/pumpkin/src/command/commands/cmd_help.rs similarity index 88% rename from pumpkin/src/commands/cmd_help.rs rename to pumpkin/src/command/commands/cmd_help.rs index 14b053950..c7a518565 100644 --- a/pumpkin/src/commands/cmd_help.rs +++ b/pumpkin/src/command/commands/cmd_help.rs @@ -1,16 +1,13 @@ use async_trait::async_trait; use pumpkin_core::text::TextComponent; -use crate::commands::dispatcher::InvalidTreeError::InvalidConsumptionError; -use crate::commands::dispatcher::{CommandDispatcher, InvalidTreeError}; -use crate::commands::tree::{Command, CommandTree, ConsumedArgs, RawArgs}; -use crate::commands::tree_builder::argument; -use crate::commands::CommandSender; +use crate::command::dispatcher::InvalidTreeError::InvalidConsumptionError; +use crate::command::dispatcher::{CommandDispatcher, InvalidTreeError}; +use crate::command::tree::{ArgumentConsumer, Command, CommandTree, ConsumedArgs, RawArgs}; +use crate::command::tree_builder::argument; +use crate::command::{CommandExecutor, CommandSender}; use crate::server::Server; -use super::tree::ArgumentConsumer; -use super::CommandExecutor; - const NAMES: [&str; 3] = ["help", "h", "?"]; const DESCRIPTION: &str = "Print a help message."; diff --git a/pumpkin/src/commands/cmd_kick.rs b/pumpkin/src/command/commands/cmd_kick.rs similarity index 71% rename from pumpkin/src/commands/cmd_kick.rs rename to pumpkin/src/command/commands/cmd_kick.rs index a91c05c55..041a1af75 100644 --- a/pumpkin/src/commands/cmd_kick.rs +++ b/pumpkin/src/command/commands/cmd_kick.rs @@ -2,12 +2,11 @@ use async_trait::async_trait; use pumpkin_core::text::color::NamedColor; use pumpkin_core::text::TextComponent; -use crate::commands::arg_player::parse_arg_player; -use crate::commands::tree::CommandTree; -use crate::commands::tree_builder::argument; - -use super::arg_player::PlayerArgumentConsumer; -use super::CommandExecutor; +use crate::command::arg_player::{parse_arg_player, PlayerArgumentConsumer}; +use crate::command::tree::CommandTree; +use crate::command::tree_builder::argument; +use crate::command::InvalidTreeError; +use crate::command::{tree::ConsumedArgs, CommandExecutor, CommandSender}; const NAMES: [&str; 1] = ["kick"]; const DESCRIPTION: &str = "Kicks the target player from the server."; @@ -20,10 +19,10 @@ struct KickExecutor {} impl CommandExecutor for KickExecutor { async fn execute<'a>( &self, - sender: &mut super::CommandSender<'a>, + sender: &mut CommandSender<'a>, server: &crate::server::Server, - args: &super::tree::ConsumedArgs<'a>, - ) -> Result<(), super::dispatcher::InvalidTreeError> { + args: &ConsumedArgs<'a>, + ) -> Result<(), InvalidTreeError> { let target = parse_arg_player(sender, server, ARG_TARGET, args).await?; target .kick(TextComponent::text("Kicked by an operator")) diff --git a/pumpkin/src/commands/cmd_kill.rs b/pumpkin/src/command/commands/cmd_kill.rs similarity index 72% rename from pumpkin/src/commands/cmd_kill.rs rename to pumpkin/src/command/commands/cmd_kill.rs index c0d0e684f..f0141ce72 100644 --- a/pumpkin/src/commands/cmd_kill.rs +++ b/pumpkin/src/command/commands/cmd_kill.rs @@ -2,12 +2,10 @@ use async_trait::async_trait; use pumpkin_core::text::color::NamedColor; use pumpkin_core::text::TextComponent; -use crate::commands::arg_player::parse_arg_player; -use crate::commands::tree::CommandTree; -use crate::commands::tree_builder::argument; - -use super::arg_player::PlayerArgumentConsumer; -use super::CommandExecutor; +use crate::command::arg_player::{parse_arg_player, PlayerArgumentConsumer}; +use crate::command::tree::CommandTree; +use crate::command::tree_builder::argument; +use crate::command::{tree::ConsumedArgs, CommandExecutor, CommandSender, InvalidTreeError}; const NAMES: [&str; 1] = ["kill"]; const DESCRIPTION: &str = "Kills a target player."; @@ -20,10 +18,10 @@ struct KillExecutor {} impl CommandExecutor for KillExecutor { async fn execute<'a>( &self, - sender: &mut super::CommandSender<'a>, + sender: &mut CommandSender<'a>, server: &crate::server::Server, - args: &super::tree::ConsumedArgs<'a>, - ) -> Result<(), super::dispatcher::InvalidTreeError> { + args: &ConsumedArgs<'a>, + ) -> Result<(), InvalidTreeError> { // TODO parse entities not only players let target = parse_arg_player(sender, server, ARG_TARGET, args).await?; target.living_entity.kill().await; diff --git a/pumpkin/src/commands/cmd_pumpkin.rs b/pumpkin/src/command/commands/cmd_pumpkin.rs similarity index 75% rename from pumpkin/src/commands/cmd_pumpkin.rs rename to pumpkin/src/command/commands/cmd_pumpkin.rs index b6023d4a1..524ad93be 100644 --- a/pumpkin/src/commands/cmd_pumpkin.rs +++ b/pumpkin/src/command/commands/cmd_pumpkin.rs @@ -2,9 +2,12 @@ use async_trait::async_trait; use pumpkin_core::text::{color::NamedColor, TextComponent}; use pumpkin_protocol::CURRENT_MC_PROTOCOL; -use crate::{commands::tree::CommandTree, server::CURRENT_MC_VERSION}; - -use super::CommandExecutor; +use crate::{ + command::{ + tree::CommandTree, tree::ConsumedArgs, CommandExecutor, CommandSender, InvalidTreeError, + }, + server::CURRENT_MC_VERSION, +}; const NAMES: [&str; 1] = ["pumpkin"]; @@ -16,10 +19,10 @@ struct PumpkinExecutor {} impl CommandExecutor for PumpkinExecutor { async fn execute<'a>( &self, - sender: &mut super::CommandSender<'a>, + sender: &mut CommandSender<'a>, _server: &crate::server::Server, - _args: &super::tree::ConsumedArgs<'a>, - ) -> Result<(), super::dispatcher::InvalidTreeError> { + _args: &ConsumedArgs<'a>, + ) -> Result<(), InvalidTreeError> { let version = env!("CARGO_PKG_VERSION"); let description = env!("CARGO_PKG_DESCRIPTION"); diff --git a/pumpkin/src/commands/cmd_say.rs b/pumpkin/src/command/commands/cmd_say.rs similarity index 84% rename from pumpkin/src/commands/cmd_say.rs rename to pumpkin/src/command/commands/cmd_say.rs index 3a58d69b3..3c1e38e50 100644 --- a/pumpkin/src/commands/cmd_say.rs +++ b/pumpkin/src/command/commands/cmd_say.rs @@ -1,13 +1,14 @@ -use super::{ - arg_simple::SimpleArgConsumer, - tree::CommandTree, - tree_builder::{argument, require}, - CommandExecutor, CommandSender, -}; use async_trait::async_trait; use pumpkin_core::text::TextComponent; use pumpkin_protocol::client::play::CSystemChatMessage; +use crate::command::{ + arg_simple::SimpleArgConsumer, + tree::{CommandTree, ConsumedArgs}, + tree_builder::{argument, require}, + CommandExecutor, CommandSender, InvalidTreeError, +}; + const NAMES: [&str; 1] = ["say"]; const DESCRIPTION: &str = "Broadcast a message to all Players."; @@ -20,10 +21,10 @@ struct SayExecutor {} impl CommandExecutor for SayExecutor { async fn execute<'a>( &self, - sender: &mut super::CommandSender<'a>, + sender: &mut CommandSender<'a>, server: &crate::server::Server, - args: &super::tree::ConsumedArgs<'a>, - ) -> Result<(), super::dispatcher::InvalidTreeError> { + args: &ConsumedArgs<'a>, + ) -> Result<(), InvalidTreeError> { let sender = match sender { CommandSender::Console => "Console", CommandSender::Rcon(_) => "Rcon", diff --git a/pumpkin/src/commands/cmd_stop.rs b/pumpkin/src/command/commands/cmd_stop.rs similarity index 72% rename from pumpkin/src/commands/cmd_stop.rs rename to pumpkin/src/command/commands/cmd_stop.rs index bb34abde6..7689a75f4 100644 --- a/pumpkin/src/commands/cmd_stop.rs +++ b/pumpkin/src/command/commands/cmd_stop.rs @@ -2,10 +2,9 @@ use async_trait::async_trait; use pumpkin_core::text::color::NamedColor; use pumpkin_core::text::TextComponent; -use crate::commands::tree::CommandTree; -use crate::commands::tree_builder::require; - -use super::CommandExecutor; +use crate::command::tree::CommandTree; +use crate::command::tree_builder::require; +use crate::command::{tree::ConsumedArgs, CommandExecutor, CommandSender, InvalidTreeError}; const NAMES: [&str; 1] = ["stop"]; @@ -17,10 +16,10 @@ struct StopExecutor {} impl CommandExecutor for StopExecutor { async fn execute<'a>( &self, - sender: &mut super::CommandSender<'a>, + sender: &mut CommandSender<'a>, _server: &crate::server::Server, - _args: &super::tree::ConsumedArgs<'a>, - ) -> Result<(), super::dispatcher::InvalidTreeError> { + _args: &ConsumedArgs<'a>, + ) -> Result<(), InvalidTreeError> { sender .send_message(TextComponent::text("Stopping Server").color_named(NamedColor::Red)) .await; diff --git a/pumpkin/src/commands/cmd_worldborder.rs b/pumpkin/src/command/commands/cmd_worldborder.rs similarity index 98% rename from pumpkin/src/commands/cmd_worldborder.rs rename to pumpkin/src/command/commands/cmd_worldborder.rs index b3f2f894d..457785466 100644 --- a/pumpkin/src/commands/cmd_worldborder.rs +++ b/pumpkin/src/command/commands/cmd_worldborder.rs @@ -4,15 +4,15 @@ use pumpkin_core::text::{ TextComponent, }; -use crate::server::Server; - -use super::{ - arg_position::{parse_arg_position, PositionArgumentConsumer}, - arg_simple::SimpleArgConsumer, - dispatcher::InvalidTreeError, - tree::{CommandTree, ConsumedArgs}, - tree_builder::{argument, literal}, - CommandExecutor, CommandSender, +use crate::{ + command::{ + arg_position::{parse_arg_position, PositionArgumentConsumer}, + arg_simple::SimpleArgConsumer, + tree::{CommandTree, ConsumedArgs}, + tree_builder::{argument, literal}, + CommandExecutor, CommandSender, InvalidTreeError, + }, + server::Server, }; const NAMES: [&str; 1] = ["worldborder"]; diff --git a/pumpkin/src/command/commands/mod.rs b/pumpkin/src/command/commands/mod.rs new file mode 100644 index 000000000..a19959aba --- /dev/null +++ b/pumpkin/src/command/commands/mod.rs @@ -0,0 +1,9 @@ +pub mod cmd_echest; +pub mod cmd_gamemode; +pub mod cmd_help; +pub mod cmd_kick; +pub mod cmd_kill; +pub mod cmd_pumpkin; +pub mod cmd_say; +pub mod cmd_stop; +pub mod cmd_worldborder; diff --git a/pumpkin/src/commands/dispatcher.rs b/pumpkin/src/command/dispatcher.rs similarity index 96% rename from pumpkin/src/commands/dispatcher.rs rename to pumpkin/src/command/dispatcher.rs index a9c76b9ef..6526d5daf 100644 --- a/pumpkin/src/commands/dispatcher.rs +++ b/pumpkin/src/command/dispatcher.rs @@ -1,10 +1,10 @@ use pumpkin_core::text::TextComponent; -use crate::commands::dispatcher::InvalidTreeError::{ +use crate::command::dispatcher::InvalidTreeError::{ InvalidConsumptionError, InvalidRequirementError, }; -use crate::commands::tree::{Command, CommandTree, ConsumedArgs, NodeType, RawArgs}; -use crate::commands::CommandSender; +use crate::command::tree::{Command, CommandTree, ConsumedArgs, NodeType, RawArgs}; +use crate::command::CommandSender; use crate::server::Server; use std::collections::HashMap; diff --git a/pumpkin/src/commands/mod.rs b/pumpkin/src/command/mod.rs similarity index 92% rename from pumpkin/src/commands/mod.rs rename to pumpkin/src/command/mod.rs index a1caab06f..573f628b0 100644 --- a/pumpkin/src/commands/mod.rs +++ b/pumpkin/src/command/mod.rs @@ -1,11 +1,15 @@ use std::sync::Arc; use async_trait::async_trait; +use commands::{ + cmd_echest, cmd_gamemode, cmd_help, cmd_kick, cmd_kill, cmd_pumpkin, cmd_say, cmd_stop, + cmd_worldborder, +}; use dispatcher::InvalidTreeError; use pumpkin_core::text::TextComponent; use tree::ConsumedArgs; -use crate::commands::dispatcher::CommandDispatcher; +use crate::command::dispatcher::CommandDispatcher; use crate::entity::player::Player; use crate::server::Server; @@ -13,16 +17,7 @@ mod arg_player; mod arg_position; mod arg_simple; -mod cmd_echest; -mod cmd_gamemode; -mod cmd_help; -mod cmd_kick; -mod cmd_kill; -mod cmd_pumpkin; -mod cmd_say; -mod cmd_stop; -mod cmd_worldborder; - +mod commands; pub mod dispatcher; mod tree; mod tree_builder; diff --git a/pumpkin/src/commands/tree.rs b/pumpkin/src/command/tree.rs similarity index 98% rename from pumpkin/src/commands/tree.rs rename to pumpkin/src/command/tree.rs index 73bea31b2..7b0d45a56 100644 --- a/pumpkin/src/commands/tree.rs +++ b/pumpkin/src/command/tree.rs @@ -1,7 +1,7 @@ use async_trait::async_trait; use super::CommandExecutor; -use crate::{commands::CommandSender, server::Server}; +use crate::{command::CommandSender, server::Server}; use std::collections::{HashMap, VecDeque}; /// see [`crate::commands::tree_builder::argument`] diff --git a/pumpkin/src/commands/tree_builder.rs b/pumpkin/src/command/tree_builder.rs similarity index 97% rename from pumpkin/src/commands/tree_builder.rs rename to pumpkin/src/command/tree_builder.rs index 4463eddd4..b6f99b533 100644 --- a/pumpkin/src/commands/tree_builder.rs +++ b/pumpkin/src/command/tree_builder.rs @@ -1,5 +1,5 @@ -use crate::commands::tree::{ArgumentConsumer, CommandTree, Node, NodeType}; -use crate::commands::CommandSender; +use crate::command::tree::{ArgumentConsumer, CommandTree, Node, NodeType}; +use crate::command::CommandSender; use super::CommandExecutor; diff --git a/pumpkin/src/commands/tree_format.rs b/pumpkin/src/command/tree_format.rs similarity index 98% rename from pumpkin/src/commands/tree_format.rs rename to pumpkin/src/command/tree_format.rs index afed1c982..70c575d46 100644 --- a/pumpkin/src/commands/tree_format.rs +++ b/pumpkin/src/command/tree_format.rs @@ -1,4 +1,4 @@ -use crate::commands::tree::{CommandTree, Node, NodeType}; +use crate::command::tree::{CommandTree, Node, NodeType}; use std::collections::VecDeque; use std::fmt::{Display, Formatter, Write}; diff --git a/pumpkin/src/main.rs b/pumpkin/src/main.rs index 038ceb596..8b7ca6071 100644 --- a/pumpkin/src/main.rs +++ b/pumpkin/src/main.rs @@ -40,7 +40,7 @@ use std::time::Instant; // Setup some tokens to allow us to identify which event is for which socket. pub mod client; -pub mod commands; +pub mod command; pub mod entity; pub mod error; pub mod proxy; @@ -257,7 +257,7 @@ fn setup_console(server: Arc) { if !out.is_empty() { let dispatcher = server.command_dispatcher.clone(); dispatcher - .handle_command(&mut commands::CommandSender::Console, &server, &out) + .handle_command(&mut command::CommandSender::Console, &server, &out) .await; } } diff --git a/pumpkin/src/rcon/mod.rs b/pumpkin/src/rcon/mod.rs index 93ad9b511..2f20c7257 100644 --- a/pumpkin/src/rcon/mod.rs +++ b/pumpkin/src/rcon/mod.rs @@ -119,7 +119,7 @@ impl RCONClient { let dispatcher = server.command_dispatcher.clone(); dispatcher .handle_command( - &mut crate::commands::CommandSender::Rcon(&output), + &mut crate::command::CommandSender::Rcon(&output), server, packet.get_body(), ) diff --git a/pumpkin/src/server/mod.rs b/pumpkin/src/server/mod.rs index 60264c99b..94bc55290 100644 --- a/pumpkin/src/server/mod.rs +++ b/pumpkin/src/server/mod.rs @@ -23,7 +23,7 @@ use tokio::sync::RwLock; use crate::client::EncryptionError; use crate::{ client::Client, - commands::{default_dispatcher, dispatcher::CommandDispatcher}, + command::{default_dispatcher, dispatcher::CommandDispatcher}, entity::player::Player, world::World, };