diff --git a/pumpkin/src/client/player_packet.rs b/pumpkin/src/client/player_packet.rs index 2457f1a62..26cc866a3 100644 --- a/pumpkin/src/client/player_packet.rs +++ b/pumpkin/src/client/player_packet.rs @@ -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), ) @@ -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), ) diff --git a/pumpkin/src/server.rs b/pumpkin/src/server.rs index 38133844b..f45c525fc 100644 --- a/pumpkin/src/server.rs +++ b/pumpkin/src/server.rs @@ -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()])) } } @@ -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( @@ -327,7 +327,8 @@ impl Server { } } - pub fn broadcast_packet_expect
(&self, from: &[&Token], packet: &P) + /// Sends a packet to all players except those specified in `from` + pub fn broadcast_packet_except
(&self, from: &[&Token], packet: &P) where P: ClientPacket, {