Exemplo n.º 1
0
        /// <summary>
        /// Saves a raw <see cref="NbtTree"/> representing a player to the given player's file.
        /// </summary>
        /// <param name="name">The name of the player to write data to.</param>
        /// <param name="tree">The player's data as an <see cref="NbtTree"/>.</param>
        /// <exception cref="NbtIOException">Thrown when the manager cannot initialize an NBT data stream for output.</exception>
        public void SetPlayerTree(string name, NbtTree tree)
        {
            PlayerFile pf     = GetPlayerFile(name);
            Stream     zipstr = pf.GetDataOutputStream();

            if (zipstr == null)
            {
                throw new NbtIOException("Failed to initialize NBT data stream for output.");
            }

            tree.WriteTo(zipstr);
            zipstr.Close();
        }