Exemplo n.º 1
0
func SendToAll(packet protocol.Packet) {
	baked := protocol.BakePacket(packet)
	for _, player := range players {
		if player.Authenticated() {
			go player.SendPacketSync(baked)
		}
	}
}
Exemplo n.º 2
0
func SendToAllNearChunk(chunkX, chunkZ int32, packet protocol.Packet) {
	id := uint64(uint32(chunkX))<<32 | uint64(uint32(chunkZ))
	baked := protocol.BakePacket(packet)
	for _, player := range players {
		if _, ok := player.(*_player).chunkSet[id]; ok {
			go player.SendPacketSync(baked)
		}
	}
}
Exemplo n.º 3
0
func SendToAllExcept(exclude Player, packet protocol.Packet) {
	baked := protocol.BakePacket(packet)
	for _, player := range players {
		if player.ID() == exclude.ID() {
			continue
		}
		if player.Authenticated() {
			go player.SendPacketSync(baked)
		}
	}
}