Exemple #1
0
 private void CheckBlock(object sender, BlockArgs args)
 {
     if (IsInside(args.X, args.Y, args.Z))
     {
         OnBlock(args);
     }
 }
Exemple #2
0
		public bool SetBlock(Player player,short x,short y,short z,byte type) {
			if (this[x,y,z]==type) { return false; }
			BlockArgs e = new BlockArgs(player,x,y,z,type);
			BlockEvent.Raise(server,this,e);
			if (e.Abort) { return false; }
			this[x,y,z] = type;
			Protocol.BlockPacket(x,y,z,type).Send(this);
			return true;
		}
Exemple #3
0
        public bool SetBlock(Player player, short x, short y, short z, byte type)
        {
            if (this[x, y, z] == type)
            {
                return(false);
            }
            BlockArgs e = new BlockArgs(player, x, y, z, type);

            BlockEvent.Raise(server, this, e);
            if (e.Abort)
            {
                return(false);
            }
            this[x, y, z] = type;
            Protocol.BlockPacket(x, y, z, type).Send(this);
            return(true);
        }
Exemple #4
0
        internal void PlayerSetBlock(Player player, short x, short y, short z, byte type)
        {
            byte      before = this[x, y, z];
            BlockArgs e      = new BlockArgs(player, x, y, z, type);

            BlockEvent.Raise(server, this, e);
            if (before == this[x, y, z])
            {
                if (e.Abort)
                {
                    Protocol.BlockPacket(x, y, z, before).Send(player);
                }
                else
                {
                    this[x, y, z] = type; Protocol.BlockPacket(x, y, z, type).Send(this, player);
                }
            }
        }
Exemple #5
0
		private void PlayerBlock(Player player,BlockArgs e,bool sendPlayer) {
			if (sendPlayer) {
				if (!player.level.SetBlock(player,e.X,e.Y,e.Z,e.Type))
					Protocol.BlockPacket(e.X,e.Y,e.Z,player.level[e.X,e.Y,e.Z]).Send(player);
			} else { player.level.PlayerSetBlock(player,e.X,e.Y,e.Z,e.Type); }
		}
Exemple #6
0
 protected virtual void OnBlock(BlockArgs args)
 {
     BlockEvent.Raise(level.server, this, args);
 }
Exemple #7
0
		protected virtual void OnBlock(BlockArgs args) {
			BlockEvent.Raise(level.server,this,args);
		}
Exemple #8
0
		private void CheckBlock(object sender,BlockArgs args) {
			if (IsInside(args.X,args.Y,args.Z)) { OnBlock(args); }
		}
Exemple #9
0
        private void OnBlock(short x, short y, short z, byte action, byte type)
        {
            if (status != OnlineStatus.Ready)
            {
                return;
            }
            if (!Group.CanBuild)
            {
                SendBlock(x, y, z); return;
            }
            if (action >= 2)
            {
                new Message("&eUnknown block action.").Send(this);
                SendBlock(x, y, z); return;
            }
            Blocktype blocktype = Blocktype.FindById(type);

            if (blocktype == null)
            {
                new Message("&eUnknown blocktype.").Send(this);
                SendBlock(x, y, z); return;
            }
            if (!blocktype.Placeable)
            {
                new Message("&eUnplaceable blocktype.").Send(this);
                SendBlock(x, y, z); return;
            }
            if (y == level.Depth)
            {
                return;
            }
            if (x >= level.Width || y >= level.Depth || z >= level.Height)
            {
                new Message("&eInvalid block position.").Send(this); return;
            }
            byte block = bind[type];

            if (action == 0)
            {
                block = 0x00;
            }
            byte before = level[x, y, z];

            if (before == block)
            {
                if (bind[type] != type)
                {
                    SendBlock(x, y, z);
                }
                return;
            }
            if (before == Blocktype.adminium.ID && !destroyAdminium)
            {
                Protocol.BlockPacket(x, y, z, 7).Send(this);
                return;
            }
            BlockArgs args = new BlockArgs(this, x, y, z, block);

            BlockEvent.Raise(server, this, args, type);
            if (!args.Abort)
            {
                InternalBlockEvent(this, args, (bind[type] != type));
            }
            else if (level[x, y, z] == before)
            {
                SendBlock(x, y, z);
            }
        }
Exemple #10
0
		private void OnBlock(short x,short y,short z,byte action,byte type) {
			if (status!=OnlineStatus.Ready) { return; }
			if (!Group.CanBuild) { SendBlock(x,y,z); return; }
			if (action>=2) {
				new Message("&eUnknown block action.").Send(this);
				SendBlock(x,y,z); return;
			} Blocktype blocktype = Blocktype.FindById(type);
			if (blocktype==null) {
				new Message("&eUnknown blocktype.").Send(this);
				SendBlock(x,y,z); return;
			} if (!blocktype.Placeable) {
				new Message("&eUnplaceable blocktype.").Send(this);
				SendBlock(x,y,z); return;
			} if (y==level.Depth) { return; }
			if (x>=level.Width || y>=level.Depth || z>=level.Height) {
				new Message("&eInvalid block position.").Send(this); return;
			} byte block = bind[type];
			if (action==0) { block = 0x00; }
			byte before = level[x,y,z];
			if (before==block) {
				if (bind[type]!=type) { SendBlock(x,y,z); }
				return;
			} if (before==Blocktype.adminium.ID && !destroyAdminium) {
				Protocol.BlockPacket(x,y,z,7).Send(this);
				return;
			} BlockArgs args = new BlockArgs(this,x,y,z,block);
			BlockEvent.Raise(server,this,args,type);
			if (!args.Abort) { InternalBlockEvent(this,args,(bind[type]!=type)); }
			else if (level[x,y,z]==before) { SendBlock(x,y,z); }
		}
Exemple #11
0
		internal void PlayerSetBlock(Player player,short x,short y,short z,byte type) {
			byte before = this[x,y,z];
			BlockArgs e = new BlockArgs(player,x,y,z,type);
			BlockEvent.Raise(server,this,e);
			if (before==this[x,y,z]) {
				if (e.Abort) { Protocol.BlockPacket(x,y,z,before).Send(player); }
				else { this[x,y,z] = type; Protocol.BlockPacket(x,y,z,type).Send(this,player); }
			}
		}