public static void RemoveAllClaims(string _playerId)
        {
            PersistentPlayerData _persistentPlayerData = PersistentOperations.GetPersistentPlayerData(_playerId);

            if (_persistentPlayerData != null)
            {
                List <Vector3i> landProtectionBlocks = _persistentPlayerData.LPBlocks;
                if (landProtectionBlocks != null)
                {
                    PersistentPlayerList _persistentPlayerList = GetPersistentPlayerList();
                    for (int i = 0; i < landProtectionBlocks.Count; i++)
                    {
                        Vector3i   _position   = landProtectionBlocks[i];
                        World      world       = GameManager.Instance.World;
                        BlockValue _blockValue = world.GetBlock(_position);
                        Block      _block      = _blockValue.Block;
                        if (_block != null && _block is BlockLandClaim)
                        {
                            world.SetBlockRPC(0, _position, BlockValue.Air);
                            ConnectionManager.Instance.SendPackage(NetPackageManager.GetPackage <NetPackageEntityMapMarkerRemove>().Setup(EnumMapObjectType.LandClaim, _position.ToVector3()), false, -1, -1, -1, -1);
                            world.ObjectOnMapRemove(EnumMapObjectType.LandClaim, _position.ToVector3());
                            LandClaimBoundsHelper.RemoveBoundsHelper(_position.ToVector3());
                        }
                        GameManager.Instance.persistentPlayers.m_lpBlockMap.Remove(_position);
                        _persistentPlayerData.LPBlocks.Remove(_position);
                    }
                    SavePersistentPlayerDataXML();
                }
            }
        }
Exemple #2
0
        public static void RemoveAllClaims(string _id)
        {
            PersistentPlayerData persistentPlayerData = GetPersistentPlayerDataFromId(_id);

            if (persistentPlayerData != null)
            {
                List <Vector3i> landProtectionBlocks = persistentPlayerData.LPBlocks;
                if (landProtectionBlocks != null)
                {
                    for (int i = 0; i < landProtectionBlocks.Count; i++)
                    {
                        Vector3i   position   = landProtectionBlocks[i];
                        World      world      = GameManager.Instance.World;
                        BlockValue blockValue = world.GetBlock(position);
                        Block      block      = blockValue.Block;
                        if (block != null && block is BlockLandClaim)
                        {
                            world.SetBlockRPC(0, position, BlockValue.Air);
                            SingletonMonoBehaviour <ConnectionManager> .Instance.SendPackage(NetPackageManager.GetPackage <NetPackageEntityMapMarkerRemove>().Setup(EnumMapObjectType.LandClaim, position.ToVector3()), false, -1, -1, -1, -1);

                            world.ObjectOnMapRemove(EnumMapObjectType.LandClaim, position.ToVector3());
                            LandClaimBoundsHelper.RemoveBoundsHelper(position.ToVector3());
                        }
                        GameManager.Instance.persistentPlayers.m_lpBlockMap.Remove(position);
                        persistentPlayerData.LPBlocks.Remove(position);
                    }
                    SavePersistentPlayerDataXML();
                }
            }
        }
        public static void RemoveOneClaim(string _playerId, Vector3i _position)
        {
            PersistentPlayerData _persistentPlayerData = PersistentOperations.GetPersistentPlayerData(_playerId);

            if (_persistentPlayerData != null)
            {
                World      world       = GameManager.Instance.World;
                BlockValue _blockValue = world.GetBlock(_position);
                Block      _block      = _blockValue.Block;
                if (_block != null && _block is BlockLandClaim)
                {
                    world.SetBlockRPC(0, _position, BlockValue.Air);
                    ConnectionManager.Instance.SendPackage(NetPackageManager.GetPackage <NetPackageEntityMapMarkerRemove>().Setup(EnumMapObjectType.LandClaim, _position.ToVector3()), false, -1, -1, -1, -1);
                    world.ObjectOnMapRemove(EnumMapObjectType.LandClaim, _position.ToVector3());
                    LandClaimBoundsHelper.RemoveBoundsHelper(_position.ToVector3());
                }
                GameManager.Instance.persistentPlayers.m_lpBlockMap.Remove(_position);
                _persistentPlayerData.LPBlocks.Remove(_position);
                SavePersistentPlayerDataXML();
            }
        }