fCraft.BuildingCommands.Place C# (CSharp) Method

Place() private static method

private static Place ( Player player, Command cmd ) : void
player Player
cmd Command
return void
        private static void Place( Player player, Command cmd )
        {
            if ( player.LastUsedBlockType != Block.Undefined ) {
                Vector3I Pos = new Vector3I( player.Position.X / 32, player.Position.Y / 32, ( player.Position.Z / 32 ) - 2 );

                if ( player.CanPlace( player.World.Map, Pos, player.LastUsedBlockType, BlockChangeContext.Manual ) != CanPlaceResult.Allowed ) {
                    player.Message( "&WYou are not allowed to build here" );
                    return;
                }

                Player.RaisePlayerPlacedBlockEvent( player, player.WorldMap, Pos, player.WorldMap.GetBlock( Pos ), player.LastUsedBlockType, BlockChangeContext.Manual );
                BlockUpdate blockUpdate = new BlockUpdate( null, Pos, player.LastUsedBlockType );
                player.World.Map.QueueUpdate( blockUpdate );
                player.Message( "Block placed below your feet" );
            } else
                player.Message( "&WError: No last used blocktype was found" );
        }