Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in method name #52

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pumpkin/src/client/player_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl Client {
};
let player = self.player.as_mut().unwrap();
let id = player.entity_id();
server.broadcast_packet_expect(
server.broadcast_packet_except(
&[&self.token],
&CEntityAnimation::new(id.into(), animation as u8),
)
Expand Down Expand Up @@ -305,7 +305,7 @@ impl Client {
let packet = &CHurtAnimation::new(&entity_id, attacker_player.entity.yaw);
self.send_packet(packet);
client.send_packet(packet);
server.broadcast_packet_expect(
server.broadcast_packet_except(
&[self.token.as_ref(), token.as_ref()],
&CHurtAnimation::new(&entity_id, 10.0),
)
Expand Down
9 changes: 5 additions & 4 deletions pumpkin/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ impl Server {
if client.is_player() {
let id = client.player.as_ref().unwrap().entity_id();
let uuid = client.gameprofile.as_ref().unwrap().id;
self.broadcast_packet_expect(
self.broadcast_packet_except(
&[&client.token],
&CRemovePlayerInfo::new(1.into(), &[UUID(uuid)]),
);
self.broadcast_packet_expect(&[&client.token], &CRemoveEntities::new(&[id.into()]))
self.broadcast_packet_except(&[&client.token], &CRemoveEntities::new(&[id.into()]))
}
}

Expand Down Expand Up @@ -241,7 +241,7 @@ impl Server {
let gameprofile = client.gameprofile.as_ref().unwrap();

// spawn player for every client
self.broadcast_packet_expect(
self.broadcast_packet_except(
&[&client.token],
// TODO: add velo
&CSpawnEntity::new(
Expand Down Expand Up @@ -327,7 +327,8 @@ impl Server {
}
}

pub fn broadcast_packet_expect<P>(&self, from: &[&Token], packet: &P)
/// Sends a packet to all players except those specified in `from`
pub fn broadcast_packet_except<P>(&self, from: &[&Token], packet: &P)
where
P: ClientPacket,
{
Expand Down