Exemplo n.º 1
0
        public void TeleportToLevel(Player player, string level)
        {
            var lvl = GetLevel(level);

            player.Level.RemovePlayer(player);
            player.Level.BroadcastPlayerRemoval(player.Wrapper);

            player.Level = lvl;

            new Respawn(player.Wrapper)
            {
                Dimension = lvl.Dimension,
                Difficulty = (byte) lvl.Difficulty,
                GameMode = (byte) lvl.DefaultGamemode
            }.Write();

            player.IsSpawned = false;
            player.KnownPosition = lvl.GetSpawnPoint();
            player.SendChunksForKnownPosition(true);
        }
Exemplo n.º 2
0
        public void TeleportToMain(Player player)
        {
            player.Level.RemovePlayer(player);
            player.Level.BroadcastPlayerRemoval(player.Wrapper);

            player.Level = MainLevel;

            new Respawn(player.Wrapper)
            {
                Dimension = 0,
                Difficulty = (byte) MainLevel.Difficulty,
                GameMode = (byte) MainLevel.DefaultGamemode
            }.Write();

            player.IsSpawned = false;
            player.KnownPosition = MainLevel.GetSpawnPoint();
            player.SendChunksForKnownPosition(true);
        }