Fix: Gamemode messages
Do not send them to target, send them to sender
This commit is contained in:
parent
9d558967c1
commit
2945a6542e
@ -36,7 +36,7 @@ rayon = "1.10.0"
|
|||||||
parking_lot = "0.12.3"
|
parking_lot = "0.12.3"
|
||||||
crossbeam = "0.8.4"
|
crossbeam = "0.8.4"
|
||||||
|
|
||||||
uuid = { version = "1.10.0", features = ["serde", "v3", "v4"] }
|
uuid = { version = "1.11.0", features = ["serde", "v3", "v4"] }
|
||||||
derive_more = { version = "1.0.0", features = ["full"] }
|
derive_more = { version = "1.0.0", features = ["full"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi
|
|||||||
|
|
||||||
- **Performance**: Leveraging multi-threading for maximum speed and efficiency.
|
- **Performance**: Leveraging multi-threading for maximum speed and efficiency.
|
||||||
- **Compatibility**: Supports the latest Minecraft server version and adheres to vanilla game mechanics.
|
- **Compatibility**: Supports the latest Minecraft server version and adheres to vanilla game mechanics.
|
||||||
- **Security**: Prioritizes security by preventing known exploits.
|
- **Security**: Prioritizes security by preventing known security exploits.
|
||||||
- **Flexibility**: Highly configurable, with the ability to disable unnecessary features.
|
- **Flexibility**: Highly configurable, with the ability to disable unnecessary features.
|
||||||
- **Extensibility**: Provides a foundation for plugin development.
|
- **Extensibility**: Provides a foundation for plugin development.
|
||||||
|
|
||||||
@ -48,6 +48,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi
|
|||||||
- [x] Entity Spawning
|
- [x] Entity Spawning
|
||||||
- [x] Chunk Loading
|
- [x] Chunk Loading
|
||||||
- [x] Chunk Generation
|
- [x] Chunk Generation
|
||||||
|
- [x] Scoreboard
|
||||||
- [ ] World Borders
|
- [ ] World Borders
|
||||||
- [ ] World Saving
|
- [ ] World Saving
|
||||||
- Player
|
- Player
|
||||||
|
|||||||
@ -9,7 +9,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi
|
|||||||
|
|
||||||
- **Performance**: Leveraging multi-threading for maximum speed and efficiency.
|
- **Performance**: Leveraging multi-threading for maximum speed and efficiency.
|
||||||
- **Compatibility**: Supports the latest Minecraft server version and adheres to vanilla game mechanics.
|
- **Compatibility**: Supports the latest Minecraft server version and adheres to vanilla game mechanics.
|
||||||
- **Security**: Prioritizes security by preventing known exploits.
|
- **Security**: Prioritizes security by preventing known security exploits.
|
||||||
- **Flexibility**: Highly configurable, with the ability to disable unnecessary features.
|
- **Flexibility**: Highly configurable, with the ability to disable unnecessary features.
|
||||||
- **Extensibility**: Provides a foundation for plugin development.
|
- **Extensibility**: Provides a foundation for plugin development.
|
||||||
|
|
||||||
@ -20,3 +20,13 @@ and customizable experience. It prioritizes performance and player enjoyment whi
|
|||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> Pumpkin is currently under heavy development. Check out our [Github Project](https://github.com/users/Snowiiii/projects/12/views/3) to see current progress
|
> Pumpkin is currently under heavy development. Check out our [Github Project](https://github.com/users/Snowiiii/projects/12/views/3) to see current progress
|
||||||
|
|
||||||
|
## Vanilla
|
||||||
|
|
||||||
|
Pumpkin is designed to replicate vanilla Minecraft logic as closely as possible,
|
||||||
|
ensuring a familiar gameplay experience. However, we've also added new features to enhance your gameplay.
|
||||||
|
|
||||||
|
### Redstone
|
||||||
|
|
||||||
|
Unlike other forks that may compromise vanilla redstone mechanics, Pumpkin maintains the original redstone behavior.
|
||||||
|
If you're looking to experiment with redstone modifications or seek performance optimizations, you have the flexibility to do so through our configurable settings.
|
||||||
|
|||||||
@ -5,12 +5,12 @@ use serde::Serialize;
|
|||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
#[packet(0x6C)]
|
#[packet(0x6C)]
|
||||||
pub struct CSystemChatMessage<'a> {
|
pub struct CSystemChatMessage<'a> {
|
||||||
content: TextComponent<'a>,
|
content: &'a TextComponent<'a>,
|
||||||
overlay: bool,
|
overlay: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CSystemChatMessage<'a> {
|
impl<'a> CSystemChatMessage<'a> {
|
||||||
pub fn new(content: TextComponent<'a>, overlay: bool) -> Self {
|
pub fn new(content: &'a TextComponent<'a>, overlay: bool) -> Self {
|
||||||
Self { content, overlay }
|
Self { content, overlay }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,6 @@ itertools.workspace = true
|
|||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
|
|
||||||
|
|
||||||
# Compression
|
# Compression
|
||||||
flate2 = "1.0"
|
flate2 = "1.0"
|
||||||
lz4 = "1.11.1"
|
lz4 = "1.11.1"
|
||||||
|
|||||||
@ -74,14 +74,14 @@ pub fn init_command_tree<'a>() -> CommandTree<'a> {
|
|||||||
|
|
||||||
return if let Player(target) = sender {
|
return if let Player(target) = sender {
|
||||||
if target.gamemode.load() == gamemode {
|
if target.gamemode.load() == gamemode {
|
||||||
target.send_system_message(TextComponent::text(&format!(
|
target.send_system_message(&TextComponent::text(&format!(
|
||||||
"You already in {:?} gamemode",
|
"You already in {:?} gamemode",
|
||||||
gamemode
|
gamemode
|
||||||
)));
|
)));
|
||||||
} else {
|
} else {
|
||||||
// TODO
|
// TODO
|
||||||
target.set_gamemode(gamemode);
|
target.set_gamemode(gamemode);
|
||||||
target.send_system_message(TextComponent::text(&format!(
|
target.send_system_message(&TextComponent::text(&format!(
|
||||||
"Game mode was set to {:?}",
|
"Game mode was set to {:?}",
|
||||||
gamemode
|
gamemode
|
||||||
)));
|
)));
|
||||||
@ -98,16 +98,16 @@ pub fn init_command_tree<'a>() -> CommandTree<'a> {
|
|||||||
let target = parse_arg_player(sender, server, ARG_TARGET, args)?;
|
let target = parse_arg_player(sender, server, ARG_TARGET, args)?;
|
||||||
|
|
||||||
if target.gamemode.load() == gamemode {
|
if target.gamemode.load() == gamemode {
|
||||||
target.send_system_message(TextComponent::text(&format!(
|
sender.send_message(TextComponent::text(&format!(
|
||||||
"You already in {:?} gamemode",
|
"{} is already in {:?} gamemode",
|
||||||
gamemode
|
target.gameprofile.name, gamemode
|
||||||
)));
|
)));
|
||||||
} else {
|
} else {
|
||||||
// TODO
|
// TODO
|
||||||
target.set_gamemode(gamemode);
|
target.set_gamemode(gamemode);
|
||||||
target.send_system_message(TextComponent::text(&format!(
|
sender.send_message(TextComponent::text(&format!(
|
||||||
"Game mode was set to {:?}",
|
"{}'s Game mode was set to {:?}",
|
||||||
gamemode
|
target.gameprofile.name, gamemode
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ impl<'a> CommandSender<'a> {
|
|||||||
match self {
|
match self {
|
||||||
// TODO: add color and stuff to console
|
// TODO: add color and stuff to console
|
||||||
CommandSender::Console => log::info!("{}", text.to_pretty_console()),
|
CommandSender::Console => log::info!("{}", text.to_pretty_console()),
|
||||||
CommandSender::Player(c) => c.send_system_message(text),
|
CommandSender::Player(c) => c.send_system_message(&text),
|
||||||
CommandSender::Rcon(s) => s.push(text.to_pretty_console()),
|
CommandSender::Rcon(s) => s.push(text.to_pretty_console()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -267,7 +267,7 @@ impl Player {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_system_message(&self, text: TextComponent) {
|
pub fn send_system_message(&self, text: &TextComponent) {
|
||||||
self.client
|
self.client
|
||||||
.send_packet(&CSystemChatMessage::new(text, false));
|
.send_packet(&CSystemChatMessage::new(text, false));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user