fix typo in method name

This commit is contained in:
Luk-ESC 2024-08-21 22:38:28 +02:00 committed by lukas0008
parent e41748b4ad
commit afa68f381c
2 changed files with 7 additions and 6 deletions

View File

@ -204,7 +204,7 @@ impl Client {
}; };
let player = self.player.as_mut().unwrap(); let player = self.player.as_mut().unwrap();
let id = player.entity_id(); let id = player.entity_id();
server.broadcast_packet_expect( server.broadcast_packet_except(
&[&self.token], &[&self.token],
&CEntityAnimation::new(id.into(), animation as u8), &CEntityAnimation::new(id.into(), animation as u8),
) )
@ -305,7 +305,7 @@ impl Client {
let packet = &CHurtAnimation::new(&entity_id, attacker_player.entity.yaw); let packet = &CHurtAnimation::new(&entity_id, attacker_player.entity.yaw);
self.send_packet(packet); self.send_packet(packet);
client.send_packet(packet); client.send_packet(packet);
server.broadcast_packet_expect( server.broadcast_packet_except(
&[self.token.as_ref(), token.as_ref()], &[self.token.as_ref(), token.as_ref()],
&CHurtAnimation::new(&entity_id, 10.0), &CHurtAnimation::new(&entity_id, 10.0),
) )

View File

@ -141,11 +141,11 @@ impl Server {
if client.is_player() { if client.is_player() {
let id = client.player.as_ref().unwrap().entity_id(); let id = client.player.as_ref().unwrap().entity_id();
let uuid = client.gameprofile.as_ref().unwrap().id; let uuid = client.gameprofile.as_ref().unwrap().id;
self.broadcast_packet_expect( self.broadcast_packet_except(
&[&client.token], &[&client.token],
&CRemovePlayerInfo::new(1.into(), &[UUID(uuid)]), &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(); let gameprofile = client.gameprofile.as_ref().unwrap();
// spawn player for every client // spawn player for every client
self.broadcast_packet_expect( self.broadcast_packet_except(
&[&client.token], &[&client.token],
// TODO: add velo // TODO: add velo
&CSpawnEntity::new( &CSpawnEntity::new(
@ -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 where
P: ClientPacket, P: ClientPacket,
{ {