Split commands into their own Folder
Now its much nicer separate from the command base
This commit is contained in:
parent
74c4662121
commit
9f70b95b9b
@ -39,10 +39,10 @@ You can also can see all the information the Packets have, which we can either W
|
|||||||
#[derive(Serialize)]
|
#[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
|
```rust
|
||||||
#[client_packet(ClientboundPlayPackets::Disconnect as i32)]
|
#[client_packet("play:disconnect")]
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Now you can create the Struct.
|
3. Now you can create the Struct.
|
||||||
@ -85,7 +85,7 @@ impl CPlayDisconnect {
|
|||||||
|
|
||||||
```rust
|
```rust
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[client_packet(ClientboundPlayPackets::Disconnect as i32)]
|
#[client_packet("play:disconnect")]
|
||||||
pub struct CPlayDisconnect {
|
pub struct CPlayDisconnect {
|
||||||
reason: TextComponent,
|
reason: TextComponent,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import java.nio.file.Paths
|
|||||||
|
|
||||||
|
|
||||||
class Extractor : ModInitializer {
|
class Extractor : ModInitializer {
|
||||||
val MOD_ID: String = "valence_extractor"
|
val MOD_ID: String = "pumpkin_extractor"
|
||||||
val LOGGER: Logger = LoggerFactory.getLogger(MOD_ID)
|
val LOGGER: Logger = LoggerFactory.getLogger(MOD_ID)
|
||||||
|
|
||||||
override fun onInitialize() {
|
override fun onInitialize() {
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
commands::CommandSender,
|
command::CommandSender,
|
||||||
entity::player::{ChatMode, Hand, Player},
|
entity::player::{ChatMode, Hand, Player},
|
||||||
server::Server,
|
server::Server,
|
||||||
world::player_chunker,
|
world::player_chunker,
|
||||||
|
|||||||
@ -2,10 +2,10 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
use crate::commands::dispatcher::InvalidTreeError;
|
use crate::command::dispatcher::InvalidTreeError;
|
||||||
use crate::commands::dispatcher::InvalidTreeError::InvalidConsumptionError;
|
use crate::command::dispatcher::InvalidTreeError::InvalidConsumptionError;
|
||||||
use crate::commands::tree::{ConsumedArgs, RawArgs};
|
use crate::command::tree::{ConsumedArgs, RawArgs};
|
||||||
use crate::commands::CommandSender;
|
use crate::command::CommandSender;
|
||||||
use crate::server::Server;
|
use crate::server::Server;
|
||||||
|
|
||||||
use super::tree::ArgumentConsumer;
|
use super::tree::ArgumentConsumer;
|
||||||
@ -1,8 +1,8 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
use crate::commands::dispatcher::InvalidTreeError;
|
use crate::command::dispatcher::InvalidTreeError;
|
||||||
use crate::commands::tree::{ConsumedArgs, RawArgs};
|
use crate::command::tree::{ConsumedArgs, RawArgs};
|
||||||
use crate::commands::CommandSender;
|
use crate::command::CommandSender;
|
||||||
use crate::server::Server;
|
use crate::server::Server;
|
||||||
|
|
||||||
use super::tree::ArgumentConsumer;
|
use super::tree::ArgumentConsumer;
|
||||||
@ -1,9 +1,9 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use pumpkin_inventory::OpenContainer;
|
use pumpkin_inventory::OpenContainer;
|
||||||
|
|
||||||
use crate::commands::tree::CommandTree;
|
use crate::command::{
|
||||||
|
tree::CommandTree, tree::ConsumedArgs, CommandExecutor, CommandSender, InvalidTreeError,
|
||||||
use super::CommandExecutor;
|
};
|
||||||
|
|
||||||
const NAMES: [&str; 2] = ["echest", "enderchest"];
|
const NAMES: [&str; 2] = ["echest", "enderchest"];
|
||||||
|
|
||||||
@ -16,10 +16,10 @@ struct EchestExecutor {}
|
|||||||
impl CommandExecutor for EchestExecutor {
|
impl CommandExecutor for EchestExecutor {
|
||||||
async fn execute<'a>(
|
async fn execute<'a>(
|
||||||
&self,
|
&self,
|
||||||
sender: &mut super::CommandSender<'a>,
|
sender: &mut CommandSender<'a>,
|
||||||
server: &crate::server::Server,
|
server: &crate::server::Server,
|
||||||
_args: &super::tree::ConsumedArgs<'a>,
|
_args: &ConsumedArgs<'a>,
|
||||||
) -> Result<(), super::dispatcher::InvalidTreeError> {
|
) -> Result<(), InvalidTreeError> {
|
||||||
if let Some(player) = sender.as_player() {
|
if let Some(player) = sender.as_player() {
|
||||||
let entity_id = player.entity_id();
|
let entity_id = player.entity_id();
|
||||||
player.open_container.store(Some(0));
|
player.open_container.store(Some(0));
|
||||||
@ -6,22 +6,18 @@ use pumpkin_core::GameMode;
|
|||||||
|
|
||||||
use crate::TextComponent;
|
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::command::dispatcher::InvalidTreeError;
|
||||||
use crate::commands::dispatcher::InvalidTreeError::{
|
use crate::command::dispatcher::InvalidTreeError::{
|
||||||
InvalidConsumptionError, InvalidRequirementError,
|
InvalidConsumptionError, InvalidRequirementError,
|
||||||
};
|
};
|
||||||
use crate::commands::tree::{CommandTree, ConsumedArgs, RawArgs};
|
use crate::command::tree::{ArgumentConsumer, CommandTree, ConsumedArgs, RawArgs};
|
||||||
use crate::commands::tree_builder::{argument, require};
|
use crate::command::tree_builder::{argument, require};
|
||||||
use crate::commands::CommandSender;
|
use crate::command::CommandSender::Player;
|
||||||
use crate::commands::CommandSender::Player;
|
use crate::command::{CommandExecutor, CommandSender};
|
||||||
use crate::server::Server;
|
use crate::server::Server;
|
||||||
|
|
||||||
use super::arg_player::PlayerArgumentConsumer;
|
|
||||||
use super::tree::ArgumentConsumer;
|
|
||||||
use super::CommandExecutor;
|
|
||||||
|
|
||||||
const NAMES: [&str; 1] = ["gamemode"];
|
const NAMES: [&str; 1] = ["gamemode"];
|
||||||
|
|
||||||
const DESCRIPTION: &str = "Change a player's gamemode.";
|
const DESCRIPTION: &str = "Change a player's gamemode.";
|
||||||
@ -1,16 +1,13 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
|
|
||||||
use crate::commands::dispatcher::InvalidTreeError::InvalidConsumptionError;
|
use crate::command::dispatcher::InvalidTreeError::InvalidConsumptionError;
|
||||||
use crate::commands::dispatcher::{CommandDispatcher, InvalidTreeError};
|
use crate::command::dispatcher::{CommandDispatcher, InvalidTreeError};
|
||||||
use crate::commands::tree::{Command, CommandTree, ConsumedArgs, RawArgs};
|
use crate::command::tree::{ArgumentConsumer, Command, CommandTree, ConsumedArgs, RawArgs};
|
||||||
use crate::commands::tree_builder::argument;
|
use crate::command::tree_builder::argument;
|
||||||
use crate::commands::CommandSender;
|
use crate::command::{CommandExecutor, CommandSender};
|
||||||
use crate::server::Server;
|
use crate::server::Server;
|
||||||
|
|
||||||
use super::tree::ArgumentConsumer;
|
|
||||||
use super::CommandExecutor;
|
|
||||||
|
|
||||||
const NAMES: [&str; 3] = ["help", "h", "?"];
|
const NAMES: [&str; 3] = ["help", "h", "?"];
|
||||||
|
|
||||||
const DESCRIPTION: &str = "Print a help message.";
|
const DESCRIPTION: &str = "Print a help message.";
|
||||||
@ -2,12 +2,11 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_core::text::color::NamedColor;
|
use pumpkin_core::text::color::NamedColor;
|
||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
|
|
||||||
use crate::commands::arg_player::parse_arg_player;
|
use crate::command::arg_player::{parse_arg_player, PlayerArgumentConsumer};
|
||||||
use crate::commands::tree::CommandTree;
|
use crate::command::tree::CommandTree;
|
||||||
use crate::commands::tree_builder::argument;
|
use crate::command::tree_builder::argument;
|
||||||
|
use crate::command::InvalidTreeError;
|
||||||
use super::arg_player::PlayerArgumentConsumer;
|
use crate::command::{tree::ConsumedArgs, CommandExecutor, CommandSender};
|
||||||
use super::CommandExecutor;
|
|
||||||
|
|
||||||
const NAMES: [&str; 1] = ["kick"];
|
const NAMES: [&str; 1] = ["kick"];
|
||||||
const DESCRIPTION: &str = "Kicks the target player from the server.";
|
const DESCRIPTION: &str = "Kicks the target player from the server.";
|
||||||
@ -20,10 +19,10 @@ struct KickExecutor {}
|
|||||||
impl CommandExecutor for KickExecutor {
|
impl CommandExecutor for KickExecutor {
|
||||||
async fn execute<'a>(
|
async fn execute<'a>(
|
||||||
&self,
|
&self,
|
||||||
sender: &mut super::CommandSender<'a>,
|
sender: &mut CommandSender<'a>,
|
||||||
server: &crate::server::Server,
|
server: &crate::server::Server,
|
||||||
args: &super::tree::ConsumedArgs<'a>,
|
args: &ConsumedArgs<'a>,
|
||||||
) -> Result<(), super::dispatcher::InvalidTreeError> {
|
) -> Result<(), InvalidTreeError> {
|
||||||
let target = parse_arg_player(sender, server, ARG_TARGET, args).await?;
|
let target = parse_arg_player(sender, server, ARG_TARGET, args).await?;
|
||||||
target
|
target
|
||||||
.kick(TextComponent::text("Kicked by an operator"))
|
.kick(TextComponent::text("Kicked by an operator"))
|
||||||
@ -2,12 +2,10 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_core::text::color::NamedColor;
|
use pumpkin_core::text::color::NamedColor;
|
||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
|
|
||||||
use crate::commands::arg_player::parse_arg_player;
|
use crate::command::arg_player::{parse_arg_player, PlayerArgumentConsumer};
|
||||||
use crate::commands::tree::CommandTree;
|
use crate::command::tree::CommandTree;
|
||||||
use crate::commands::tree_builder::argument;
|
use crate::command::tree_builder::argument;
|
||||||
|
use crate::command::{tree::ConsumedArgs, CommandExecutor, CommandSender, InvalidTreeError};
|
||||||
use super::arg_player::PlayerArgumentConsumer;
|
|
||||||
use super::CommandExecutor;
|
|
||||||
|
|
||||||
const NAMES: [&str; 1] = ["kill"];
|
const NAMES: [&str; 1] = ["kill"];
|
||||||
const DESCRIPTION: &str = "Kills a target player.";
|
const DESCRIPTION: &str = "Kills a target player.";
|
||||||
@ -20,10 +18,10 @@ struct KillExecutor {}
|
|||||||
impl CommandExecutor for KillExecutor {
|
impl CommandExecutor for KillExecutor {
|
||||||
async fn execute<'a>(
|
async fn execute<'a>(
|
||||||
&self,
|
&self,
|
||||||
sender: &mut super::CommandSender<'a>,
|
sender: &mut CommandSender<'a>,
|
||||||
server: &crate::server::Server,
|
server: &crate::server::Server,
|
||||||
args: &super::tree::ConsumedArgs<'a>,
|
args: &ConsumedArgs<'a>,
|
||||||
) -> Result<(), super::dispatcher::InvalidTreeError> {
|
) -> Result<(), InvalidTreeError> {
|
||||||
// TODO parse entities not only players
|
// TODO parse entities not only players
|
||||||
let target = parse_arg_player(sender, server, ARG_TARGET, args).await?;
|
let target = parse_arg_player(sender, server, ARG_TARGET, args).await?;
|
||||||
target.living_entity.kill().await;
|
target.living_entity.kill().await;
|
||||||
@ -2,9 +2,12 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_core::text::{color::NamedColor, TextComponent};
|
use pumpkin_core::text::{color::NamedColor, TextComponent};
|
||||||
use pumpkin_protocol::CURRENT_MC_PROTOCOL;
|
use pumpkin_protocol::CURRENT_MC_PROTOCOL;
|
||||||
|
|
||||||
use crate::{commands::tree::CommandTree, server::CURRENT_MC_VERSION};
|
use crate::{
|
||||||
|
command::{
|
||||||
use super::CommandExecutor;
|
tree::CommandTree, tree::ConsumedArgs, CommandExecutor, CommandSender, InvalidTreeError,
|
||||||
|
},
|
||||||
|
server::CURRENT_MC_VERSION,
|
||||||
|
};
|
||||||
|
|
||||||
const NAMES: [&str; 1] = ["pumpkin"];
|
const NAMES: [&str; 1] = ["pumpkin"];
|
||||||
|
|
||||||
@ -16,10 +19,10 @@ struct PumpkinExecutor {}
|
|||||||
impl CommandExecutor for PumpkinExecutor {
|
impl CommandExecutor for PumpkinExecutor {
|
||||||
async fn execute<'a>(
|
async fn execute<'a>(
|
||||||
&self,
|
&self,
|
||||||
sender: &mut super::CommandSender<'a>,
|
sender: &mut CommandSender<'a>,
|
||||||
_server: &crate::server::Server,
|
_server: &crate::server::Server,
|
||||||
_args: &super::tree::ConsumedArgs<'a>,
|
_args: &ConsumedArgs<'a>,
|
||||||
) -> Result<(), super::dispatcher::InvalidTreeError> {
|
) -> Result<(), InvalidTreeError> {
|
||||||
let version = env!("CARGO_PKG_VERSION");
|
let version = env!("CARGO_PKG_VERSION");
|
||||||
let description = env!("CARGO_PKG_DESCRIPTION");
|
let description = env!("CARGO_PKG_DESCRIPTION");
|
||||||
|
|
||||||
@ -1,13 +1,14 @@
|
|||||||
use super::{
|
|
||||||
arg_simple::SimpleArgConsumer,
|
|
||||||
tree::CommandTree,
|
|
||||||
tree_builder::{argument, require},
|
|
||||||
CommandExecutor, CommandSender,
|
|
||||||
};
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use pumpkin_protocol::client::play::CSystemChatMessage;
|
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 NAMES: [&str; 1] = ["say"];
|
||||||
|
|
||||||
const DESCRIPTION: &str = "Broadcast a message to all Players.";
|
const DESCRIPTION: &str = "Broadcast a message to all Players.";
|
||||||
@ -20,10 +21,10 @@ struct SayExecutor {}
|
|||||||
impl CommandExecutor for SayExecutor {
|
impl CommandExecutor for SayExecutor {
|
||||||
async fn execute<'a>(
|
async fn execute<'a>(
|
||||||
&self,
|
&self,
|
||||||
sender: &mut super::CommandSender<'a>,
|
sender: &mut CommandSender<'a>,
|
||||||
server: &crate::server::Server,
|
server: &crate::server::Server,
|
||||||
args: &super::tree::ConsumedArgs<'a>,
|
args: &ConsumedArgs<'a>,
|
||||||
) -> Result<(), super::dispatcher::InvalidTreeError> {
|
) -> Result<(), InvalidTreeError> {
|
||||||
let sender = match sender {
|
let sender = match sender {
|
||||||
CommandSender::Console => "Console",
|
CommandSender::Console => "Console",
|
||||||
CommandSender::Rcon(_) => "Rcon",
|
CommandSender::Rcon(_) => "Rcon",
|
||||||
@ -2,10 +2,9 @@ use async_trait::async_trait;
|
|||||||
use pumpkin_core::text::color::NamedColor;
|
use pumpkin_core::text::color::NamedColor;
|
||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
|
|
||||||
use crate::commands::tree::CommandTree;
|
use crate::command::tree::CommandTree;
|
||||||
use crate::commands::tree_builder::require;
|
use crate::command::tree_builder::require;
|
||||||
|
use crate::command::{tree::ConsumedArgs, CommandExecutor, CommandSender, InvalidTreeError};
|
||||||
use super::CommandExecutor;
|
|
||||||
|
|
||||||
const NAMES: [&str; 1] = ["stop"];
|
const NAMES: [&str; 1] = ["stop"];
|
||||||
|
|
||||||
@ -17,10 +16,10 @@ struct StopExecutor {}
|
|||||||
impl CommandExecutor for StopExecutor {
|
impl CommandExecutor for StopExecutor {
|
||||||
async fn execute<'a>(
|
async fn execute<'a>(
|
||||||
&self,
|
&self,
|
||||||
sender: &mut super::CommandSender<'a>,
|
sender: &mut CommandSender<'a>,
|
||||||
_server: &crate::server::Server,
|
_server: &crate::server::Server,
|
||||||
_args: &super::tree::ConsumedArgs<'a>,
|
_args: &ConsumedArgs<'a>,
|
||||||
) -> Result<(), super::dispatcher::InvalidTreeError> {
|
) -> Result<(), InvalidTreeError> {
|
||||||
sender
|
sender
|
||||||
.send_message(TextComponent::text("Stopping Server").color_named(NamedColor::Red))
|
.send_message(TextComponent::text("Stopping Server").color_named(NamedColor::Red))
|
||||||
.await;
|
.await;
|
||||||
@ -4,15 +4,15 @@ use pumpkin_core::text::{
|
|||||||
TextComponent,
|
TextComponent,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::server::Server;
|
use crate::{
|
||||||
|
command::{
|
||||||
use super::{
|
arg_position::{parse_arg_position, PositionArgumentConsumer},
|
||||||
arg_position::{parse_arg_position, PositionArgumentConsumer},
|
arg_simple::SimpleArgConsumer,
|
||||||
arg_simple::SimpleArgConsumer,
|
tree::{CommandTree, ConsumedArgs},
|
||||||
dispatcher::InvalidTreeError,
|
tree_builder::{argument, literal},
|
||||||
tree::{CommandTree, ConsumedArgs},
|
CommandExecutor, CommandSender, InvalidTreeError,
|
||||||
tree_builder::{argument, literal},
|
},
|
||||||
CommandExecutor, CommandSender,
|
server::Server,
|
||||||
};
|
};
|
||||||
|
|
||||||
const NAMES: [&str; 1] = ["worldborder"];
|
const NAMES: [&str; 1] = ["worldborder"];
|
||||||
9
pumpkin/src/command/commands/mod.rs
Normal file
9
pumpkin/src/command/commands/mod.rs
Normal file
@ -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;
|
||||||
@ -1,10 +1,10 @@
|
|||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
|
|
||||||
use crate::commands::dispatcher::InvalidTreeError::{
|
use crate::command::dispatcher::InvalidTreeError::{
|
||||||
InvalidConsumptionError, InvalidRequirementError,
|
InvalidConsumptionError, InvalidRequirementError,
|
||||||
};
|
};
|
||||||
use crate::commands::tree::{Command, CommandTree, ConsumedArgs, NodeType, RawArgs};
|
use crate::command::tree::{Command, CommandTree, ConsumedArgs, NodeType, RawArgs};
|
||||||
use crate::commands::CommandSender;
|
use crate::command::CommandSender;
|
||||||
use crate::server::Server;
|
use crate::server::Server;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
@ -1,11 +1,15 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
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 dispatcher::InvalidTreeError;
|
||||||
use pumpkin_core::text::TextComponent;
|
use pumpkin_core::text::TextComponent;
|
||||||
use tree::ConsumedArgs;
|
use tree::ConsumedArgs;
|
||||||
|
|
||||||
use crate::commands::dispatcher::CommandDispatcher;
|
use crate::command::dispatcher::CommandDispatcher;
|
||||||
use crate::entity::player::Player;
|
use crate::entity::player::Player;
|
||||||
use crate::server::Server;
|
use crate::server::Server;
|
||||||
|
|
||||||
@ -13,16 +17,7 @@ mod arg_player;
|
|||||||
mod arg_position;
|
mod arg_position;
|
||||||
mod arg_simple;
|
mod arg_simple;
|
||||||
|
|
||||||
mod cmd_echest;
|
mod commands;
|
||||||
mod cmd_gamemode;
|
|
||||||
mod cmd_help;
|
|
||||||
mod cmd_kick;
|
|
||||||
mod cmd_kill;
|
|
||||||
mod cmd_pumpkin;
|
|
||||||
mod cmd_say;
|
|
||||||
mod cmd_stop;
|
|
||||||
mod cmd_worldborder;
|
|
||||||
|
|
||||||
pub mod dispatcher;
|
pub mod dispatcher;
|
||||||
mod tree;
|
mod tree;
|
||||||
mod tree_builder;
|
mod tree_builder;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
use super::CommandExecutor;
|
use super::CommandExecutor;
|
||||||
use crate::{commands::CommandSender, server::Server};
|
use crate::{command::CommandSender, server::Server};
|
||||||
use std::collections::{HashMap, VecDeque};
|
use std::collections::{HashMap, VecDeque};
|
||||||
|
|
||||||
/// see [`crate::commands::tree_builder::argument`]
|
/// see [`crate::commands::tree_builder::argument`]
|
||||||
@ -1,5 +1,5 @@
|
|||||||
use crate::commands::tree::{ArgumentConsumer, CommandTree, Node, NodeType};
|
use crate::command::tree::{ArgumentConsumer, CommandTree, Node, NodeType};
|
||||||
use crate::commands::CommandSender;
|
use crate::command::CommandSender;
|
||||||
|
|
||||||
use super::CommandExecutor;
|
use super::CommandExecutor;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
use crate::commands::tree::{CommandTree, Node, NodeType};
|
use crate::command::tree::{CommandTree, Node, NodeType};
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use std::fmt::{Display, Formatter, Write};
|
use std::fmt::{Display, Formatter, Write};
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ use std::time::Instant;
|
|||||||
// Setup some tokens to allow us to identify which event is for which socket.
|
// Setup some tokens to allow us to identify which event is for which socket.
|
||||||
|
|
||||||
pub mod client;
|
pub mod client;
|
||||||
pub mod commands;
|
pub mod command;
|
||||||
pub mod entity;
|
pub mod entity;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod proxy;
|
pub mod proxy;
|
||||||
@ -257,7 +257,7 @@ fn setup_console(server: Arc<Server>) {
|
|||||||
if !out.is_empty() {
|
if !out.is_empty() {
|
||||||
let dispatcher = server.command_dispatcher.clone();
|
let dispatcher = server.command_dispatcher.clone();
|
||||||
dispatcher
|
dispatcher
|
||||||
.handle_command(&mut commands::CommandSender::Console, &server, &out)
|
.handle_command(&mut command::CommandSender::Console, &server, &out)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,7 +119,7 @@ impl RCONClient {
|
|||||||
let dispatcher = server.command_dispatcher.clone();
|
let dispatcher = server.command_dispatcher.clone();
|
||||||
dispatcher
|
dispatcher
|
||||||
.handle_command(
|
.handle_command(
|
||||||
&mut crate::commands::CommandSender::Rcon(&output),
|
&mut crate::command::CommandSender::Rcon(&output),
|
||||||
server,
|
server,
|
||||||
packet.get_body(),
|
packet.get_body(),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -23,7 +23,7 @@ use tokio::sync::RwLock;
|
|||||||
use crate::client::EncryptionError;
|
use crate::client::EncryptionError;
|
||||||
use crate::{
|
use crate::{
|
||||||
client::Client,
|
client::Client,
|
||||||
commands::{default_dispatcher, dispatcher::CommandDispatcher},
|
command::{default_dispatcher, dispatcher::CommandDispatcher},
|
||||||
entity::player::Player,
|
entity::player::Player,
|
||||||
world::World,
|
world::World,
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user