예제 #1
0
파일: Types.cs 프로젝트: umby24/ZBase
        public NbtCompound Write()
        {
            var baseComp = new NbtCompound("ZBase");

            if (HackPermissions != null)
            {
                var hackTag = new NbtCompound("HackPerms")
                {
                    new NbtByte("Fly", HackPermissions.Fly ? (byte)1 : (byte)0),
                    new NbtByte("Clip", HackPermissions.NoClip ? (byte)1 : (byte)0),
                    new NbtByte("Spawn", HackPermissions.Spawn ? (byte)1 : (byte)0),
                    new NbtByte("Speed", HackPermissions.Speed ? (byte)1 : (byte)0),
                    new NbtByte("Third", HackPermissions.ThirdPerson ? (byte)1 : (byte)0),
                    new NbtShort("Jump", HackPermissions.JumpHeight)
                };
                baseComp.Add(hackTag);
            }

            if (EnviromentProperties != null)
            {
                var propsTag = new NbtCompound("EnvProps");

                foreach (KeyValuePair <EnvProperties, int> property in EnviromentProperties)
                {
                    propsTag.Add(new NbtInt(property.Key.ToString(), property.Value));
                }

                baseComp.Add(propsTag);
            }

            if (!string.IsNullOrEmpty(TextureUrl))
            {
                baseComp.Add(new NbtString("TextureUrl", TextureUrl));
            }

            var permsComp = new NbtCompound("Permissions")
            {
                new NbtShort("Build", BuildRank),
                new NbtShort("Show", ShowRank),
                new NbtShort("Join", JoinRank)
            };

            baseComp.Add(permsComp);
            baseComp.Add(new NbtInt("Version", MetadataVersion));

            return(baseComp.Any() ? baseComp : null);
        }