Example #1
0
        public void CatchBlock2(Player sender, BlockChangeEventArgs args)
        {
            ushort x = args.X;
            ushort y = args.Y;
            ushort z = args.Z;
            byte NewType = args.Holding;
            bool placed = (args.Action == ActionType.Place);
            CatchPos FirstBlock = (CatchPos)sender.GetDatapass("CmdReplace_cpos"); ;
            unchecked {
                if (FirstBlock.type != (byte)-1) {
                    NewType = FirstBlock.type;
                }
            }
            List<Pos> buffer = new List<Pos>();

            for (ushort xx = Math.Min((ushort)(FirstBlock.pos.x), x); xx <= Math.Max((ushort)(FirstBlock.pos.x), x); ++xx) {
                for (ushort zz = Math.Min((ushort)(FirstBlock.pos.z), z); zz <= Math.Max((ushort)(FirstBlock.pos.z), z); ++zz) {
                    for (ushort yy = Math.Min((ushort)(FirstBlock.pos.y), y); yy <= Math.Max((ushort)(FirstBlock.pos.y), y); ++yy) {
                        Vector3S loop = new Vector3S(xx, zz, yy);
                        if (sender.Level.GetBlock(loop) == NewType) {
                            BufferAdd(buffer, loop);
                        }
                    }
                }
            }
            //Group Max Blocks permissions here
            sender.SendMessage(buffer.Count.ToString() + " blocks.");

            //Level Blockqueue .-.

            buffer.ForEach(delegate(Pos pos) {
                sender.Level.BlockChange((ushort)(pos.pos.x), (ushort)(pos.pos.z), (ushort)(pos.pos.y), FirstBlock.type2);
            });
        }
 public void CatchBlock2(Player sender, BlockChangeEventArgs args)
 {
     args.Unregister();
     Vector3S FirstBlock = (Vector3S)sender.GetDatapass("CmdDatapassExample_FirstBlock");
     Vector3S SecondBlock = new Vector3S(args.X, args.Z, args.Y);
     sender.SendMessage("This is where we would initiate a Cuboid!");
 }
Example #3
0
        void OnBlockChange(Player sender, BlockChangeEventArgs e) {
            sender.OnPlayerBlockChange.Normal -= OnBlockChange;
            e.Cancel();
            using (var data = Database.fillData("SELECT * FROM Blocks WHERE X = '" + e.X + "' AND Y = '" + e.Y + "' AND Z = '" + e.Z + "' AND Level = '" + sender.Level.Name.MySqlEscape() + "';")) {

                if (data.Rows.Count == 0) {
                    sender.SendMessage("This block has not been modified since the map was cleared or created.");
                    return;
                }

                for (int i = 0; i < data.Rows.Count; i++) {
                    string username;
                    string color;
                    string block;
                    string time;
                    bool deleted;

                    using (var playerData = Database.fillData("SELECT * FROM _players WHERE UID = " + data.Rows[i]["UID"].ToString())) {
                        username = playerData.Rows[0]["Name"].ToString();
                        color = playerData.Rows[0]["color"].ToString();
                    }

                    block = ((Block)byte.Parse(data.Rows[i]["Block"].ToString())).Name;
                    time = DateTime.Parse(data.Rows[i]["Date"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                    deleted = data.Rows[i]["Deleted"].ToString().ToLower() == "true";
                    sender.SendMessage((deleted ? "&4Destroyed by " : "&3Created by ") + Server.DefaultColor + color + username + Server.DefaultColor + ", using &3" + block + Server.DefaultColor + " At " + time);
                }
            }
            if (sender.StaticCommandsEnabled) {
                sender.SendMessage("Break block to get info");
                sender.OnPlayerBlockChange.Normal += OnBlockChange;
            }
        }
Example #4
0
 void BlockChange1(Player sender, BlockChangeEventArgs args) {
     CatchPos cpos = (CatchPos)sender.GetDatapass(Name);
     cpos.pos = new Vector3S((short)args.X, (short)args.Z, (short)args.Y);
     args.Cancel();
     sender.OnPlayerBlockChange.Normal -= BlockChange1;
     sender.SetDatapass(Name, cpos);
     sender.OnPlayerBlockChange.Normal += BlockChange2;
 }
 public void CatchBlock(Player sender, BlockChangeEventArgs args)
 {
     args.Unregister();
     Vector3S FirstBlock = new Vector3S(args.X, args.Z, args.Y);
     sender.SendMessage("Please place another block...");
     sender.SetDatapass("CmdDatapassExample_FirstBlock", FirstBlock);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
 }
 public void CatchBlock2(Player p, BlockChangeEventArgs args)
 {
     p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock2);
     CatchPos cpos = (CatchPos)p.GetDatapass(this.Name);
     cpos.pos2 = new Vector3S(args.X, args.Z, args.Y);
     args.Cancel();
     Replace(cpos, p);
 }
 public void CatchBlock1(Player p, BlockChangeEventArgs args)
 {
     CatchPos cpos = (CatchPos)p.GetDatapass(this.Name);
     cpos.pos = new Vector3S(args.X, args.Z, args.Y);
     args.Cancel();
     p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock1);
     p.SetDatapass(this.Name, cpos);
     p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
 }
Example #8
0
 public void BC1(Player p, BlockChangeEventArgs args)
 {
     p.ExtraData["Mark1"] = new Vector3S(args.X, args.Z, args.Y);
     p.SendMessage("First coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")");
     args.Unregister();
     args.Cancel();
     p.SendMessage("Break or place a block to select the second point.");
     p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(BC2);
 }
 //public void CatchBlock(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass)
 public void CatchBlock(Player sender, BlockChangeEventArgs args)
 {
     CatchPos cpos = (CatchPos)sender.GetDatapass("CmdReplaceNot_cpos");
     cpos.pos = new Vector3S(args.X, args.Z, args.Y);
     args.Unregister();
     sender.SetDatapass("CmdReplaceNot_cpos", cpos);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
     //p.CatchNextBlockchange(CatchBlock2, (object)cpos);
 }
Example #10
0
 public void CatchBlock(Player sender, BlockChangeEventArgs args)
 {
     CatchPos cpos = (CatchPos)sender.GetDatapass("CmdReplace_cpos"); ;
     cpos.pos = new Vector3S(args.X, args.Y, args.Z);
     args.Unregister();
     args.Cancel();
     sender.SetDatapass("CmdReplace_cpos", cpos);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
 }
Example #11
0
 void BlockChange2(Player sender, BlockChangeEventArgs args) {
     //string direction = null;
     sender.OnPlayerBlockChange.Normal -= BlockChange2;
     CatchPos cpos = (CatchPos)sender.GetDatapass(this.Name);
     foreach (Vector3S v in BlockString(cpos.message, cpos.pos, new Vector3S(args.X, args.Z, args.Y), sender.Level.Size)) {
         sender.Level.BlockChange(v, args.Holding, sender);
     }
     args.Cancel();
     return;
 }
Example #12
0
 //public void CatchBlock(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass)
 public void CatchBlock(Player sender, BlockChangeEventArgs args) {
     args.Cancel();
     args.Unregister();
     sender.SendBlockChange(args.X, args.Z, args.Y, sender.Level.GetBlock(args.X, args.Z, args.Y));
     CatchPos cpos = (CatchPos)sender.GetDatapass("CmdMeasure_cpos");
     cpos.FirstBlock = new Vector3S(args.X, args.Z, args.Y);
     sender.SetDatapass("CmdMeasure_cpos", cpos);
     sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
     //p.CatchNextBlockchange(new Player.BlockChangeDelegate(CatchBlock2), (object)cpos);
 }
Example #13
0
        private void OnAllPlayersBlockChangeOnHigh(Player sender, BlockChangeEventArgs args)
        {
            var zones = Zone.FindAllWithin(new Vector3D(args.X, args.Z, args.Y));
            foreach (var zone in zones)
            {
                if (zone.CanBuildIn(sender)) continue;

                sender.SendMessage("You cannot build in this Zone! This zone if for: " + (PlayerGroup.FindPermInt(zone.Permission) ?? ("Permission: " + zone.Permission)) + " or higher!");
                args.Cancel();
                return;
            }
        }
Example #14
0
 public void BC2(Player p, BlockChangeEventArgs args)
 {
     Vector3S _s = new Vector3S();
     p.ExtraData["Mark2"] = new Vector3S(args.X, args.Z, args.Y);
     p.SendMessage("Second coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")");
     args.Unregister();
     args.Cancel();
     Vector3S m1 = (Vector3S)p.ExtraData["Mark1"];
     Vector3S m2 = (Vector3S)p.ExtraData["Mark2"];
     p.SendMessage("Marked coordinates:");
     p.SendMessage("(" + m1.x + ", " + m1.z + ", " + m1.y + "), (" + m2.x + ", " + m2.z + ", " + m2.y + ")");
     p.ExtraData["HasMarked"] = true;
 }
Example #15
0
 //public void CatchBlock2(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass)
 public void CatchBlock2(Player sender, BlockChangeEventArgs args) {
     args.Cancel();
     args.Unregister();
     sender.SendBlockChange(args.X, args.Z, args.Y, sender.Level.GetBlock(args.X, args.Z, args.Y));
     CatchPos cpos = (CatchPos)sender.GetDatapass("CmdMeasure_cpos");
     Vector3S FirstBlock = cpos.FirstBlock;
     ushort xx, zz, yy;
     int count = 0;
     for (xx = Math.Min((ushort)(FirstBlock.x), args.X); xx <= Math.Max((ushort)(FirstBlock.x), args.X); ++xx)
         for (zz = Math.Min((ushort)(FirstBlock.z), args.Z); zz <= Math.Max((ushort)(FirstBlock.z), args.Z); ++zz)
             for (yy = Math.Min((ushort)(FirstBlock.y), args.Y); yy <= Math.Max((ushort)(FirstBlock.y), args.Y); ++yy) {
                 if (cpos.ignore == null || !cpos.ignore.Contains(sender.Level.GetBlock(xx, zz, yy))) {
                     count++;
                 }
             }
     sender.SendMessage(count + " blocks are between (" + FirstBlock.x + ", " + FirstBlock.z + ", " + FirstBlock.y + ") and (" + args.X + ", " + args.Z + ", " + args.Y + ")");
 }
        public void OnAllPlayersBlockChange(Player sender, BlockChangeEventArgs evt)
        {
            byte perBuild = 0;

                try
                {
                    perBuild = (byte)sender.Level.Settings.perbuild;
                }
                catch
                {
                }

            if (sender.Group.Permission < perBuild)
            {
                sender.SendMessage("You cannot build here");
                evt.Cancel();
            }
        }
        public void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs evt)
        {
            byte perBuildMax = byte.MaxValue;

            if (sender.Level.ExtraData.ContainsKey("perbuildmax"))
            {
                try
                {
                    perBuildMax = (byte)sender.Level.ExtraData["perbuildmax"];
                }
                catch
                {
                    perBuildMax = byte.MaxValue;
                }
            }

            if (sender.Group.Permission > perBuildMax)
            {
                sender.SendMessage("You cannot build here");
                evt.Cancel();
            }
        }
Example #18
0
 void OnPlayerBlockChange_Normal(Player sender, BlockChangeEventArgs args) {
     args.Cancel();
     if (args.Current == 0 && args.Action == ActionType.Delete) args.Current = 20;
     sender.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
     if (sender.ExtraData["Cursor"] != null) {
         Vector3S cursor;
         if (sender.ExtraData["Cursor"].GetType() == typeof(Vector3S))
             cursor = (Vector3S)sender.ExtraData["Cursor"];
         else {
             cursor = new Vector3S();
             cursor.FromString((string)sender.ExtraData["Cursor"]);
         }
         if (args.Action == ActionType.Place) {
             sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y + 1), args.Holding);
         }
         else {
             sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y), args.Holding, false);
         }
     }
     sender.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
     Curse(sender);
 }
 void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs args) {
     Vector3S v = new Vector3S(args.X, args.Z, args.Y);
     if (store[sender.Level.Name].Contains(v)) {
         object msg = sender.Level.ExtraData["MessageBlock" + v];
         if (msg != null && msg.GetType() == typeof(string) && ((string)msg).Length > 0) {
             if (((string)msg).StartsWith("c")) {
                 if (removeCommandOnAir && (args.Action == ActionType.Delete || args.Holding == 0)) {
                     Remove(sender.Level, v);
                 }
                 else if (protectBlockType) {
                     args.Cancel();
                 }
             }
             else {
                 if (removeMessageOnAir && (args.Action == ActionType.Delete || args.Holding == 0)) {
                     Remove(sender.Level, v);
                 }
                 else if (protectBlockType) {
                     args.Cancel();
                 }
             }
         }
     }
 }
Example #20
0
        public void CatchBlock2(Player sender, BlockChangeEventArgs args)
        {
            CatchPos FirstBlock = (CatchPos)sender.GetDatapass("CmdReplaceNot_cpos");
            List<Pos> buffer = new List<Pos>();

            for (ushort xx = Math.Min((ushort)(FirstBlock.pos.x), args.X); xx <= Math.Max((ushort)(FirstBlock.pos.x), args.X); ++xx) {
                for (ushort zz = Math.Min((ushort)(FirstBlock.pos.z), args.Z); zz <= Math.Max((ushort)(FirstBlock.pos.z), args.Z); ++zz) {
                    for (ushort yy = Math.Min((ushort)(FirstBlock.pos.y), args.Y); yy <= Math.Max((ushort)(FirstBlock.pos.y), args.Y); ++yy) {
                        Vector3S loop = new Vector3S(xx, zz, yy);
                        if (sender.Level.GetBlock(loop) != FirstBlock.type) {
                            BufferAdd(buffer, loop);
                        }
                    }
                }
            }
            //Group Max Blocks permissions here
            sender.SendMessage(buffer.Count.ToString() + " blocks.");

            //Level Blockqueue .-.

            buffer.ForEach(delegate(Pos pos) {
                sender.Level.BlockChange((ushort)(pos.pos.x), (ushort)(pos.pos.z), (ushort)(pos.pos.y), FirstBlock.type2);
            });
        }
Example #21
0
 public void CatchBlock2(Player p, BlockChangeEventArgs args)
 {
     p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock2);
     CatchPos cpos = (CatchPos)p.GetDatapass(this.Name);
     cpos.secondPos = new Vector3S(args.X, args.Z, args.Y);
     cpos.block = args.Holding;
     args.Cancel();
     Cuboid(cpos, p);
 }
Example #22
0
        void BlockChange(Player sender, BlockChangeEventArgs e) {
            e.Cancel();
            
            var raw = (BrushData)sender.ExtraData.GetIfExist<object, object> ("BrushData");

            if(raw == null){
                sender.SendMessage("An error occurred while trying to brush");
                sender.OnPlayerBlockChange.Normal -= BlockChange;
                return;
            }

            byte block = raw.Block != 255 ? raw.Block : e.Holding;
            Vector3S loc = new Vector3S(e.X, e.Z, e.Y);
            IBrush b = (IBrush)Activator.CreateInstance(raw.BrushType);
            var qq = b.Draw(loc, raw.Block, raw.Size);

            if (sender.Group.MaxBlockChange < qq.Count()) {
                sender.SendMessage("You cannot set that many blocks");
                return;
            }

            foreach (var fml in qq) 
                sender.SendBlockChange((ushort)fml.x, (ushort)fml.z, (ushort)fml.y, block);

#if DEBUG
            sender.SendMessage(string.Format("Brushed {0} blocks", qq.Count())); 
#endif
        }
Example #23
0
 public void CatchBlock2(Player p, BlockChangeEventArgs args)
 {
     p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock2);
     CatchPos cpos = (CatchPos)p.GetDatapass(this.Name);
     Cuboid(cpos, args.Holding, p, args.X, args.Y, args.Z);
     args.Cancel();
 }
        private void HandleBlockchange(ushort x, ushort y, ushort z, byte action, byte newType, bool fake)
        {


            LastClick = new Vector3S(x, y, z);

            if (newType > 49 || (newType == 7 && !IsAdmin))
            {
                Kick("HACKED CLIENT!");
                //TODO Send message to op's for adminium hack
                return;
            }

            byte currentType = 50;
            if (y < Level.Size.y)
            {
                currentType = Level.GetBlock(x, z, y);
                if (!Block.IsValidBlock(currentType) && currentType != 255)
                {
                    Kick("HACKED SERVER!");
                    return;
                }
            }
            else
            {
                return;
            }

            bool placing = (action == 1);
            BlockChangeEventArgs eargs = new BlockChangeEventArgs(x, z, y, (placing ? ActionType.Place : ActionType.Delete), newType, Level.GetBlock(x, z, y));
            eargs = OnPlayerBlockChange.Call(this, eargs, OnAllPlayersBlockChange);
            if (eargs.Canceled)
            {
                if (!fake)
                    SendBlockChange(x, z, y, Level.GetBlock(eargs.X, eargs.Z, eargs.Y));
                return;
            }
            x = eargs.X;
            z = eargs.Z;
            y = eargs.Y;
            action = (byte)((eargs.Action == ActionType.Place) ? 1 : 0);
            placing = action == 1;
            newType = eargs.Holding;
            currentType = eargs.Current;
            
            if (blockChange != null)
            {
                if (fake)
                    SendBlockChange(x, z, y, currentType);

                BlockChangeDelegate tempBlockChange = blockChange;
                if (!ExtraData.ContainsKey("PassBackData"))
                    ExtraData.Add("PassBackData", null);

                object tempPassBack = ExtraData["PassBackData"];

                blockChange = null;
                ExtraData["PassBackData"] = null;

                ThreadPool.QueueUserWorkItem(delegate
                {
                    tempBlockChange.Invoke(this, x, z, y, newType, placing, tempPassBack);
                });
                return;
            }
           

            if (action == 0) //Deleting
            {
                Level.BlockChange(x, z, y, 0, this);
            }
            else //Placing
            {
                Level.BlockChange(x, z, y, newType, this);
            }

            //BlockChanges.Add(new World.Blocks.BlockChange(new Vector3S(x, z, y), blockFrom, newType, action == 0));
        }
Example #25
0
 void BlockChange2(Player sender, BlockChangeEventArgs args)
 {
     //string direction = null;
     sender.OnPlayerBlockChange.Normal -= BlockChange2;
     CatchPos cpos = (CatchPos)sender.GetDatapass(this.Name);
     foreach (Vector3S v in BlockString(cpos.message, cpos.pos, new Vector3S(args.X, args.Z, args.Y), sender.Level.CWMap.Size)) {
         BlockQueue.Addblock(sender, (ushort)v.x, (ushort)v.y, (ushort)v.z, args.Holding);
     }
     args.Cancel();
     return;
 }
 void add_Normal(Player sender, BlockChangeEventArgs args) {
     sender.OnPlayerBlockChange.Normal -= add_Normal;
     args.Cancel();
     string message = (string)sender.GetDatapass("MessageBlockMessage");
     add(sender.Level, args.X, args.Z, args.Y, message, sender);
 }
 void remove_Normal(Player sender, BlockChangeEventArgs args) {
     sender.OnPlayerBlockChange.Normal -= remove_Normal;
     args.Cancel();
     Vector3S v = new Vector3S(args.X, args.Z, args.Y);
     PluginMessageBlock pmb = (PluginMessageBlock)Plugin.getByType(typeof(PluginMessageBlock).Name);
     if (pmb == null) {
         sender.SendMessage(typeof(PluginMessageBlock).Name + " is currently not loaded");
         return;
     }
     if (pmb.Remove(sender.Level, v)) {
         sender.SendMessage("Message block removed");
     }
     else {
         sender.SendMessage("There was already no message set for this block");
     }
 }
        public void OnBlockChange(Player Player, BlockChangeEventArgs args)
        {
            ExtraPlayerData p = FindPlayer(Player);

            #region Block Placing Limit
            if (p.AmountOfBlocksLeft <= 0 && ZombieRoundEnabled && args.Action == ActionType.Place)
            {
                Player.SendMessage("[Zombie Survival]: " + Colors.red + "You don't have any more blocks! You can buy more at the /store!");
                args.Cancel();
                return;
            }
            if (ZombieRoundEnabled && args.Action == ActionType.Place && !p.Referee)
            p.AmountOfBlocksLeft -= 1;
            if ((p.AmountOfBlocksLeft % 10 == 0 || p.AmountOfBlocksLeft < 6) && ZombieRoundEnabled && args.Action == ActionType.Place && !p.Referee)
                p.Player.SendMessage("[Zombie Survival]: " + Colors.red + "You have " + p.AmountOfBlocksLeft + " blocks left!");
            #endregion

            #region Anti-spleef/bedrock
            if (args.Action == ActionType.Delete && Player.Level.GetBlock(args.X, args.Z, args.Y) == Block.BlockList.BEDROCK && !p.Referee)
            {
                p.Player.SendMessage("[Zombie Survival]: " + Colors.red + "You cannot break this >:(");
                if (p.TheTypeOfNotification != 1)
                    WOM.GlobalSendAlert(Player.Username + " tried to break bedrock (Hacking?)");
                p.TheTypeOfNotification = 1;
                args.Cancel();
                return;
            }

            if (args.Action == ActionType.Delete && !p.Referee)
            {
                foreach (Player z in Server.Players.ToArray())
                {
                    if (new Vector3S(args.X, args.Z, (ushort)(args.Y + 2)) == (z.Pos / 32) && !z.IsHidden && z != Player)
                    {
                        p.Player.SendMessage("[Zombie Survival]: " + Colors.red + "You cannot spleef another player >:(");
                        if (p.TheTypeOfNotification != 2)
                            WOM.GlobalSendAlert(Player.Username + " spleefed " + z.Username);
                        p.TheTypeOfNotification = 2;
                        args.Cancel();
                        return;
                    }
                }
            }
            #endregion

            #region Anti-pillaring
            if (args.Y - p.LastYValue == 1 && !p.Referee)
            {
                p.AmountOfPillars += 1;
                if (p.AmountOfPillars > 7)
                {
                    p.Player.Kick("You are not allowed to pillar on this server!");
                }
            }
            else
            {
                if (p.AmountOfPillars > 0)
                {
                    p.AmountOfPillars -= 1;
                }
            }
            p.LastYValue = args.Y;
            #endregion
        }
        void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs args) {

            string username = Helper.GetOwner(new Vector3S(args.X, args.Z, args.Y), sender.Level.Name);
            if (username == null) //no owner, ADD ALL THE BLOCKS
                return;

            if ((AllowList.Count == 0 && username != sender.Username) || (AllowList.ContainsKey(username) &&
                !AllowList[username].Contains(sender) &&
                sender.Group.Permission > (byte)PermissionLevel.Operator &&
                args.Action != ActionType.Place)) {

                sender.SendMessage("U silly head, you didnt make this. Ask " + username + " to add you to list");
                args.Cancel();
            }

            if (!hasPlayerInfo(sender)) {
                players.Add(new PlayerInfo(sender));
                return;
            }
            PlayerInfo pi = getPlayerInfo(sender);
            if (pi.LastBlock == args.Holding && args.Action == ActionType.Place) {
                if (pi.LastPlace.AddMilliseconds(1000) > DateTime.Now)
                    pi.offense++;
                else
                    pi.offense--;
                if (getPlayerInfo(sender).kicked)
                    args.Cancel();
            }
        }
Example #30
0
 private void OnPlayerBlockChangeOnNormal(Player sender, BlockChangeEventArgs args)
 {
     var b = (Block) sender.ExtraData["BlockMode"];
     if (args.Action == ActionType.Delete) return;
     args.Holding = b;
     var physicsBlock = b as PhysicsBlock;
     if (physicsBlock == null) return;
     sender.Level.pblocks.Add(physicsBlock);
 }