Exemplo n.º 1
0
        public override void DespawnFromPlayer(Player player)
        {
            McpeRemovePlayer mcpeRemovePlayer = McpeRemovePlayer.CreateObject();

            mcpeRemovePlayer.entityId = EntityId;
            player.SendPackage(mcpeRemovePlayer);
        }
Exemplo n.º 2
0
Arquivo: Level.cs Projeto: Eros/MiNET
        public void SendRemoveForPlayer(Player receiver, Player player, bool sendRemovePlayerList = true)
        {
            if (player == receiver)
            {
                return;
            }

            McpeRemovePlayer mcpeRemovePlayer = McpeRemovePlayer.CreateObject();

            mcpeRemovePlayer.clientUuid = player.ClientUuid;
            mcpeRemovePlayer.entityId   = player.EntityId;
            receiver.SendPackage(mcpeRemovePlayer);
        }
Exemplo n.º 3
0
Arquivo: Level.cs Projeto: Eros/MiNET
        public void DespawnFromAll(Player player)
        {
            lock (_playerWriteLock)
            {
                List <Player> spawnedPlayers = GetSpawnedPlayers().ToList();

                McpePlayerList playerListMessage = McpePlayerList.CreateObject();
                playerListMessage.records = new PlayerRemoveRecords(spawnedPlayers);
                var bytes = playerListMessage.Encode();
                playerListMessage.records = null;

                MemoryStream memStream = new MemoryStream();
                memStream.Write(BitConverter.GetBytes(Endian.SwapInt32(bytes.Length)), 0, 4);
                memStream.Write(bytes, 0, bytes.Length);

                McpeBatch batch  = McpeBatch.CreateObject();
                byte[]    buffer = Player.CompressBytes(memStream.ToArray(), CompressionLevel.Optimal);
                batch.payloadSize = buffer.Length;
                batch.payload     = buffer;
                batch.Encode();
                player.SendPackage(batch);

                foreach (Player spawnedPlayer in spawnedPlayers)
                {
                    SendRemoveForPlayer(player, spawnedPlayer, false);
                }

                McpePlayerList playerList = McpePlayerList.CreateObject();
                playerList.records = new PlayerRemoveRecords {
                    player
                };
                playerList.Encode();
                playerList.records = null;
                RelayBroadcast(player, playerList);

                McpeRemovePlayer removePlayerMessage = McpeRemovePlayer.CreateObject();
                removePlayerMessage.clientUuid = player.ClientUuid;
                removePlayerMessage.entityId   = player.EntityId;
                RelayBroadcast(player, removePlayerMessage);
            }
        }
Exemplo n.º 4
0
        public override void DespawnFromPlayer(Player player)
        {
            {
                Player fake = new Player(null, null, 0)
                {
                    ClientUuid = Uuid,
                    EntityId   = EntityId,
                    NameTag    = NameTag ?? Name,
                    Skin       = Skin
                };

                McpePlayerList playerList = McpePlayerList.CreateObject();
                playerList.records = new PlayerRemoveRecords {
                    fake
                };
                player.SendPackage(playerList);
            }

            McpeRemovePlayer mcpeRemovePlayer = McpeRemovePlayer.CreateObject();

            mcpeRemovePlayer.entityId   = EntityId;
            mcpeRemovePlayer.clientUuid = Uuid;
            player.SendPackage(mcpeRemovePlayer);
        }
Exemplo n.º 5
0
        public override void DespawnFromPlayers(Player[] players)
        {
            {
                Player fake = new Player(null, null)
                {
                    ClientUuid = Uuid,
                    EntityId   = EntityId,
                    NameTag    = NameTag ?? Name,
                    Skin       = Skin
                };

                McpePlayerList playerList = McpePlayerList.CreateObject();
                playerList.records = new PlayerRemoveRecords {
                    fake
                };
                Level.RelayBroadcast(players, playerList);
            }

            McpeRemovePlayer mcpeRemovePlayer = McpeRemovePlayer.CreateObject();

            mcpeRemovePlayer.entityId   = EntityId;
            mcpeRemovePlayer.clientUuid = Uuid;
            Level.RelayBroadcast(players, mcpeRemovePlayer);
        }