Skip to content

Commit

Permalink
Fix: Gamemode messages
Browse files Browse the repository at this point in the history
Do not send them to target, send them to sender
  • Loading branch information
Snowiiii committed Oct 19, 2024
1 parent 9d55896 commit 2945a65
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rayon = "1.10.0"
parking_lot = "0.12.3"
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"] }
serde = { version = "1.0", features = ["derive"] }

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi

- **Performance**: Leveraging multi-threading for maximum speed and efficiency.
- **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.
- **Extensibility**: Provides a foundation for plugin development.

Expand Down Expand Up @@ -48,6 +48,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi
- [x] Entity Spawning
- [x] Chunk Loading
- [x] Chunk Generation
- [x] Scoreboard
- [ ] World Borders
- [ ] World Saving
- Player
Expand Down
12 changes: 11 additions & 1 deletion docs/about/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and customizable experience. It prioritizes performance and player enjoyment whi

- **Performance**: Leveraging multi-threading for maximum speed and efficiency.
- **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.
- **Extensibility**: Provides a foundation for plugin development.

Expand All @@ -20,3 +20,13 @@ and customizable experience. It prioritizes performance and player enjoyment whi

> [!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
## 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.
4 changes: 2 additions & 2 deletions pumpkin-protocol/src/client/play/c_system_chat_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use serde::Serialize;
#[derive(Serialize)]
#[packet(0x6C)]
pub struct CSystemChatMessage<'a> {
content: TextComponent<'a>,
content: &'a TextComponent<'a>,
overlay: bool,
}

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 }
}
}
1 change: 0 additions & 1 deletion pumpkin-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ itertools.workspace = true
thiserror = "1.0"
futures = "0.3"


# Compression
flate2 = "1.0"
lz4 = "1.11.1"
Expand Down
16 changes: 8 additions & 8 deletions pumpkin/src/commands/cmd_gamemode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ pub fn init_command_tree<'a>() -> CommandTree<'a> {

return if let Player(target) = sender {
if target.gamemode.load() == gamemode {
target.send_system_message(TextComponent::text(&format!(
target.send_system_message(&TextComponent::text(&format!(
"You already in {:?} gamemode",
gamemode
)));
} else {
// TODO
target.set_gamemode(gamemode);
target.send_system_message(TextComponent::text(&format!(
target.send_system_message(&TextComponent::text(&format!(
"Game mode was set to {:?}",
gamemode
)));
Expand All @@ -98,16 +98,16 @@ pub fn init_command_tree<'a>() -> CommandTree<'a> {
let target = parse_arg_player(sender, server, ARG_TARGET, args)?;

if target.gamemode.load() == gamemode {
target.send_system_message(TextComponent::text(&format!(
"You already in {:?} gamemode",
gamemode
sender.send_message(TextComponent::text(&format!(
"{} is already in {:?} gamemode",
target.gameprofile.name, gamemode
)));
} else {
// TODO
target.set_gamemode(gamemode);
target.send_system_message(TextComponent::text(&format!(
"Game mode was set to {:?}",
gamemode
sender.send_message(TextComponent::text(&format!(
"{}'s Game mode was set to {:?}",
target.gameprofile.name, gamemode
)));
}

Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'a> CommandSender<'a> {
match self {
// TODO: add color and stuff to 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()),
}
}
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/entity/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ impl Player {
));
}

pub fn send_system_message(&self, text: TextComponent) {
pub fn send_system_message(&self, text: &TextComponent) {
self.client
.send_packet(&CSystemChatMessage::new(text, false));
}
Expand Down

0 comments on commit 2945a65

Please sign in to comment.