コード例 #1
0
ファイル: Protected.cs プロジェクト: mctraveler/MineSharp
        /// <summary>
        /// Prevent block modification, aplies to all, residents should never get called here
        /// </summary>
        public static bool ProtectBlockBreak(VanillaSession session, WorldRegion region, PlayerDigging d)
        {
            if (IsBlockProtected(session, region) == false)
                return false;

            //Block single click from outside the adventure mode
            if (d.Status == PlayerDigging.StatusEnum.StartedDigging)
                return true;
            
            if (d.Status != PlayerDigging.StatusEnum.FinishedDigging)
                return false;

            //Old method - not needed
            BlockChange bc = new BlockChange(d.Position, BlockID.Bedrock);
            session.Player.SendToClient(bc);

            //New method - Works
            /*
            PlayerDigging pd = new PlayerDigging();
            pd.Position = d.Position;
            pd.Face = Face.Down;
            pd.Status = PlayerDigging.StatusEnum.CheckBlock;
            session.FromClient(pd);
            */

            return true;
        }
コード例 #2
0
ファイル: SpawnRegion.cs プロジェクト: mctraveler/MineSharp
        static bool CursedLand(Client player, PlayerBlockPlacement placement)
        {
            SlotItem i = player.Session.ActiveItem;
            if (i != null && i.ItemID == BlockID.Bucket)
            {
                var pps = new PlayerPositionLookClient();
                pps.Position = placement.BlockPosition.CloneDouble();
                pps.OnGround = false;
                pps.Position.Y += 1.1;
                pps.Position.X += 0.5;
                pps.Position.Z += 0.5;
                pps.Pitch = Math.PI / 2;
                pps.Yaw = player.Session.Yaw;
                player.FromClient(pps);
				
                var ppc = new PlayerPositionLookServer(pps.Position);
                ppc.Pitch = Math.PI / 2;
                ppc.Yaw = player.Session.Yaw;
                player.SendToClient(ppc);
            }
			
            BlockChange bc = new BlockChange(placement.BlockPosition.Offset(placement.FaceDirection), BlockID.Air);
            player.SendToClient(bc);
			
            //Block all actions
            return true;
        }
コード例 #3
0
ファイル: SpawnRegion.cs プロジェクト: mctraveler/MineSharp
        static bool DiggProtect(Client player, PlayerDigging pd)
        {
            if (pd.Status == PlayerDigging.StatusEnum.FinishedDigging)
            {
                BlockChange bc = new BlockChange(pd.Position.Offset(pd.Face), BlockID.Fire);
                player.SendToClient(bc);
				
                player.TellAbove(Chat.Purple, "You are still in spawn");
                return true;
            }
			
            return false;
        }